add illumos support (#433)

This commit is contained in:
Dominik Hassler authored and GitHub committed 2024-06-29 22:25:47 +08:00
1 parent e40994d62e
commit 041a603173
2 files changed
+12 -9

No files matched your search

+4 -3
View File
@@ -20,10 +20,11 @@ fn new_socket(addr: SocketAddr, reuse: bool, buf_size: usize) -> Result<Socket,
SocketAddr::V6(..) => Socket::new(Domain::ipv6(), Type::dgram(), None),
}?;
if reuse {
// windows has no reuse_port, but it's reuse_address
// windows has no reuse_port, but its reuse_address
// almost equals to unix's reuse_port + reuse_address,
// though may introduce nondeterministic behavior
#[cfg(unix)]
// though may introduce nondeterministic behavior.
// illumos has no support for SO_REUSEPORT
#[cfg(all(unix, not(target_os = "illumos")))]
socket.set_reuse_port(true)?;
socket.set_reuse_address(true)?;
}