@@ -62,10 +62,11 @@ fn new_socket(addr: std::net::SocketAddr, reuse: bool) -> Result<TcpSocket, std:
6262 std:: net:: SocketAddr :: V6 ( ..) => TcpSocket :: new_v6 ( ) ?,
6363 } ;
6464 if reuse {
65- // windows has no reuse_port, but it's reuse_address
65+ // windows has no reuse_port, but its reuse_address
6666 // almost equals to unix's reuse_port + reuse_address,
67- // though may introduce nondeterministic behavior
68- #[ cfg( unix) ]
67+ // though may introduce nondeterministic behavior.
68+ // illumos has no support for SO_REUSEPORT
69+ #[ cfg( all( unix, not( target_os = "illumos" ) ) ) ]
6970 socket. set_reuseport ( true ) ?;
7071 socket. set_reuseaddr ( true ) ?;
7172 }
@@ -263,10 +264,11 @@ pub async fn new_listener<T: ToSocketAddrs>(addr: T, reuse: bool) -> ResultType<
263264pub async fn listen_any ( port : u16 , reuse : bool ) -> ResultType < TcpListener > {
264265 if let Ok ( mut socket) = TcpSocket :: new_v6 ( ) {
265266 if reuse {
266- // windows has no reuse_port, but it's reuse_address
267+ // windows has no reuse_port, but its reuse_address
267268 // almost equals to unix's reuse_port + reuse_address,
268- // though may introduce nondeterministic behavior
269- #[ cfg( unix) ]
269+ // though may introduce nondeterministic behavior.
270+ // illumos has no support for SO_REUSEPORT
271+ #[ cfg( all( unix, not( target_os = "illumos" ) ) ) ]
270272 socket. set_reuseport ( true ) . ok ( ) ;
271273 socket. set_reuseaddr ( true ) . ok ( ) ;
272274 }
0 commit comments