about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYoung Wu <doomsplayer@gmail.com>2015-04-23 10:27:44 +0800
committerYoung Wu <doomsplayer@gmail.com>2015-04-23 10:27:44 +0800
commit4d6e2f5334ea1b2455357e279e8606b69dd9cf4c (patch)
tree83aead17a06b2b372d9cf41652d0484f02a2f4e3
parent00978a9879d882002c59c5f3474fbe0b858963a7 (diff)
downloadrust-4d6e2f5334ea1b2455357e279e8606b69dd9cf4c.tar.gz
rust-4d6e2f5334ea1b2455357e279e8606b69dd9cf4c.zip
implement set_tcp_keepalive for linux
-rw-r--r--src/libstd/sys/common/net2.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libstd/sys/common/net2.rs b/src/libstd/sys/common/net2.rs
index 7d42d65d360..2b2c31d92ed 100644
--- a/src/libstd/sys/common/net2.rs
+++ b/src/libstd/sys/common/net2.rs
@@ -202,15 +202,19 @@ impl TcpStream {
         setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
                    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<()> {
         setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
                    seconds as c_int)
     }
+
     #[cfg(not(any(target_os = "macos",
                   target_os = "ios",
                   target_os = "freebsd",
-                  target_os = "dragonfly")))]
+                  target_os = "dragonfly",
+                  target_os = "linux")))]
     fn set_tcp_keepalive(&self, _seconds: u32) -> io::Result<()> {
         Ok(())
     }