Merge pull request #1014 from niklasha/openbsd-missing-tcp-keepalive-options

OpenBSD misses some TCP keepalive options
This commit is contained in:
Steven Fackler 2023-04-04 14:42:59 -04:00 committed by GitHub
commit 7dd6813fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,12 +12,17 @@ impl From<&KeepaliveConfig> for TcpKeepalive {
fn from(keepalive_config: &KeepaliveConfig) -> Self { fn from(keepalive_config: &KeepaliveConfig) -> Self {
let mut tcp_keepalive = Self::new().with_time(keepalive_config.idle); let mut tcp_keepalive = Self::new().with_time(keepalive_config.idle);
#[cfg(not(any(target_os = "redox", target_os = "solaris")))] #[cfg(not(any(target_os = "redox", target_os = "solaris", target_os = "openbsd")))]
if let Some(interval) = keepalive_config.interval { if let Some(interval) = keepalive_config.interval {
tcp_keepalive = tcp_keepalive.with_interval(interval); tcp_keepalive = tcp_keepalive.with_interval(interval);
} }
#[cfg(not(any(target_os = "redox", target_os = "solaris", target_os = "windows")))] #[cfg(not(any(
target_os = "redox",
target_os = "solaris",
target_os = "windows",
target_os = "openbsd"
)))]
if let Some(retries) = keepalive_config.retries { if let Some(retries) = keepalive_config.retries {
tcp_keepalive = tcp_keepalive.with_retries(retries); tcp_keepalive = tcp_keepalive.with_retries(retries);
} }