diff --git a/Cargo.toml b/Cargo.toml index 2847621..37e6166 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,9 @@ categories = ["network-programming"] description = "mDNS Service Discovery library with no async runtime dependency" [features] -reuseport = [] async = ["flume/async"] logging = ["log"] -default = ["reuseport", "async", "logging"] +default = ["async", "logging"] [dependencies] fastrand = "2.3" diff --git a/src/service_daemon.rs b/src/service_daemon.rs index 0e10c1a..34600c0 100644 --- a/src/service_daemon.rs +++ b/src/service_daemon.rs @@ -741,9 +741,13 @@ fn new_socket(addr: SocketAddr, non_block: bool) -> Result { fd.set_reuse_address(true) .map_err(|e| e_fmt!("set ReuseAddr failed: {}", e))?; - #[cfg(all(unix, feature = "reuseport"))] // this is currently restricted to Unix's in socket2 - fd.set_reuse_port(true) - .map_err(|e| e_fmt!("set ReusePort failed: {}", e))?; + #[cfg(unix)] + if let Err(e) = fd.set_reuse_port(true) { + debug!( + "SO_REUSEPORT is not supported, continuing without it: {}", + e + ); + } if non_block { fd.set_nonblocking(true)