From b21d7a6c2c44dbf664f5bb522c37b956cdeffb7b Mon Sep 17 00:00:00 2001 From: suchao Date: Sun, 20 Oct 2024 15:06:40 +0800 Subject: [PATCH] fix macOS build --- src/bin/udpgw_server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/udpgw_server.rs b/src/bin/udpgw_server.rs index 9e1a728..97f0643 100644 --- a/src/bin/udpgw_server.rs +++ b/src/bin/udpgw_server.rs @@ -180,7 +180,7 @@ pub fn parse_udp(udp_mtu: u16, data_len: usize, data: &[u8]) -> Result<(&[u8], u async fn process_udp(addr: SocketAddr, udp_timeout: u64, tx: Sender>, con: &mut UdpRequest) -> Result<()> { let std_sock = std::net::UdpSocket::bind("0.0.0.0:0")?; std_sock.set_nonblocking(true)?; - #[cfg(unix)] + #[cfg(target_os = "linux")] nix::sys::socket::setsockopt(&std_sock, nix::sys::socket::sockopt::ReuseAddr, &true)?; let socket = UdpSocket::from_std(std_sock)?; socket.send_to(&con.data, &con.server_addr).await?;