From 2e683380fa1f9cd2e93b9836d5fa9f1f3e9e8b66 Mon Sep 17 00:00:00 2001 From: Erk Date: Sun, 7 Jul 2024 17:29:26 +0200 Subject: [PATCH] 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. --- src/driver/connection/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/driver/connection/mod.rs b/src/driver/connection/mod.rs index 9545881e2..56f4fe44d 100644 --- a/src/driver/connection/mod.rs +++ b/src/driver/connection/mod.rs @@ -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())?