Skip to content

Commit ea58799

Browse files
committed
implement set_tcp_keepalive for linux
why use dummy implementation on linux?
1 parent 00978a9 commit ea58799

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libstd/sys/common/net2.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,16 @@ impl TcpStream {
207207
setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
208208
seconds as c_int)
209209
}
210+
#[cfg(target_os = "linux")]
211+
fn set_tcp_keepalive(&self, seconds: u32) -> io::Result<()> {
212+
setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
213+
seconds as c_int)
214+
}
210215
#[cfg(not(any(target_os = "macos",
211216
target_os = "ios",
212217
target_os = "freebsd",
213-
target_os = "dragonfly")))]
218+
target_os = "dragonfly",
219+
target_os = "linux")))]
214220
fn set_tcp_keepalive(&self, _seconds: u32) -> io::Result<()> {
215221
Ok(())
216222
}

0 commit comments

Comments
 (0)