melib/connections.rs: Fix compilation for macos

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/394/head
Manos Pitsidianakis 1 month ago
parent 4148aee59b
commit c65635ef60
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -423,11 +423,34 @@ impl Connection {
self.inner_setsockopt(libc::SOL_SOCKET, libc::SO_KEEPALIVE, <c_int>::from(false))
},
SockOpts::TcpNoDelay { enable } => unsafe {
self.inner_setsockopt(
libc::SOL_TCP,
libc::TCP_NODELAY,
if enable { c_int::from(1_u8) } else { 0 },
)
#[cfg(any(
target_os = "openbsd",
target_os = "netbsd",
target_os = "haiku",
target_os = "macos",
target_os = "ios"
))]
{
self.inner_setsockopt(
libc::IPPROTO_TCP,
libc::TCP_NODELAY,
if enable { c_int::from(1_u8) } else { 0 },
)
}
#[cfg(not(any(
target_os = "openbsd",
target_os = "netbsd",
target_os = "haiku",
target_os = "macos",
target_os = "ios"
)))]
{
self.inner_setsockopt(
libc::SOL_TCP,
libc::TCP_NODELAY,
if enable { c_int::from(1_u8) } else { 0 },
)
}
},
}
}

Loading…
Cancel
Save