Skip to content

Commit

Permalink
Fix compilation error on Haiku
Browse files Browse the repository at this point in the history
A fixup for b0732a3
  • Loading branch information
link2xt authored and Thomasdezeeuw committed Jul 28, 2021
1 parent b0732a3 commit e00edab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub(crate) type Bool = c_int;

#[cfg(target_vendor = "apple")]
use libc::TCP_KEEPALIVE as KEEPALIVE_TIME;
#[cfg(not(any(target_vendor = "apple")))]
#[cfg(not(any(target_vendor = "apple", target_os = "haiku", target_os = "openbsd")))]
use libc::TCP_KEEPIDLE as KEEPALIVE_TIME;

/// Helper macro to execute a system call that returns an `io::Result`.
Expand Down Expand Up @@ -873,6 +873,7 @@ pub(crate) fn keepalive_time(fd: Socket) -> io::Result<Duration> {
}
}

#[allow(unused_variables)]
pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Result<()> {
#[cfg(not(any(target_os = "haiku", target_os = "openbsd")))]
if let Some(time) = keepalive.time {
Expand Down Expand Up @@ -904,6 +905,7 @@ pub(crate) fn set_tcp_keepalive(fd: Socket, keepalive: &TcpKeepalive) -> io::Res
Ok(())
}

#[cfg(not(any(target_os = "haiku", target_os = "openbsd")))]
fn into_secs(duration: Duration) -> c_int {
min(duration.as_secs(), c_int::max_value() as u64) as c_int
}
Expand Down

0 comments on commit e00edab

Please sign in to comment.