diff options
Diffstat (limited to 'src/sys/unix/tcp.rs')
-rw-r--r-- | src/sys/unix/tcp.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/sys/unix/tcp.rs b/src/sys/unix/tcp.rs index c4d7e94..9513cc0 100644 --- a/src/sys/unix/tcp.rs +++ b/src/sys/unix/tcp.rs @@ -40,7 +40,7 @@ pub(crate) fn listen(socket: &net::TcpListener, backlog: u32) -> io::Result<()> } pub(crate) fn set_reuseaddr(socket: &net::TcpListener, reuseaddr: bool) -> io::Result<()> { - let val: libc::c_int = if reuseaddr { 1 } else { 0 }; + let val: libc::c_int = i32::from(reuseaddr); syscall!(setsockopt( socket.as_raw_fd(), libc::SOL_SOCKET, @@ -60,16 +60,13 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream, #[cfg(any( // Android x86's seccomp profile forbids calls to `accept4(2)` // See https://github.com/tokio-rs/mio/issues/1445 for details - all( - not(target_arch="x86"), - target_os = "android" - ), + all(not(target_arch="x86"), target_os = "android"), target_os = "dragonfly", target_os = "freebsd", target_os = "illumos", target_os = "linux", target_os = "netbsd", - target_os = "openbsd" + target_os = "openbsd", ))] let stream = { syscall!(accept4( @@ -85,10 +82,10 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream, // OSes inherit the non-blocking flag from the listener, so we just have to // set `CLOEXEC`. #[cfg(any( - all(target_arch = "x86", target_os = "android"), target_os = "ios", target_os = "macos", - target_os = "redox" + target_os = "redox", + all(target_arch = "x86", target_os = "android"), ))] let stream = { syscall!(accept( |