Auto merge of #24594 - doomsplayer:patch-2, r=alexcrichton

why use dummy implementation on linux?
This commit is contained in:
bors 2015-04-24 17:49:46 +00:00
commit 2214860d4a

View File

@ -202,15 +202,19 @@ impl TcpStream {
setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
seconds as c_int) seconds as c_int)
} }
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] #[cfg(any(target_os = "freebsd",
target_os = "dragonfly",
target_os = "linux"))]
fn set_tcp_keepalive(&self, seconds: u32) -> io::Result<()> { fn set_tcp_keepalive(&self, seconds: u32) -> io::Result<()> {
setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
seconds as c_int) seconds as c_int)
} }
#[cfg(not(any(target_os = "macos", #[cfg(not(any(target_os = "macos",
target_os = "ios", target_os = "ios",
target_os = "freebsd", target_os = "freebsd",
target_os = "dragonfly")))] target_os = "dragonfly",
target_os = "linux")))]
fn set_tcp_keepalive(&self, _seconds: u32) -> io::Result<()> { fn set_tcp_keepalive(&self, _seconds: u32) -> io::Result<()> {
Ok(()) Ok(())
} }