fix(conn): Some operating systems does not allow 0 recv buffer (#243)

This will cause FreeBSD to fail setting up the socket. It may also be true of some other operating systems, but these are the ones I have been able to test.

It works on Windows and Linux.
This commit is contained in:
Erk
2024-07-07 17:29:26 +02:00
committed by GitHub
parent 5bbe80f20c
commit 2e683380fa

View File

@@ -115,7 +115,8 @@ impl Connection {
} else {
let socket = Socket::from(udp.into_std()?);
#[cfg(not(target_os = "macos"))]
// Some operating systems does not allow setting the recv buffer to 0.
#[cfg(any(target_os = "linux", target_os = "windows"))]
socket.set_recv_buffer_size(0)?;
UdpSocket::from_std(socket.into())?