From 728d9115e894bd3c8fc3ae03230ea46f85467c04 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 27 Feb 2016 21:05:32 -0800 Subject: Fix windows Also back out keepalive support for TCP since the API is perhaps not actually what we want. You can't read the interval on Windows, and we should probably separate the functionality of turning keepalive on and overriding the interval. --- src/libstd/sys/common/net.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/libstd/sys/common') diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 31d3be45372..c8738fd1ba5 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -14,7 +14,7 @@ use cmp; use ffi::{CStr, CString}; use fmt; use io::{self, Error, ErrorKind}; -use libc::{c_int, c_char, c_void}; +use libc::{c_int, c_char, c_void, c_uint}; use mem; #[allow(deprecated)] use net::{SocketAddr, Shutdown, IpAddr, Ipv4Addr, Ipv6Addr}; @@ -84,13 +84,13 @@ fn sockaddr_to_addr(storage: &c::sockaddr_storage, } #[cfg(target_os = "android")] -fn to_ipv6mr_interface(value: u32) -> c::c_int { - value as c::c_int +fn to_ipv6mr_interface(value: u32) -> c_int { + value as c_int } #[cfg(not(target_os = "android"))] -fn to_ipv6mr_interface(value: u32) -> c::c_uint { - value as c::c_uint +fn to_ipv6mr_interface(value: u32) -> c_uint { + value as c_uint } //////////////////////////////////////////////////////////////////////////////// @@ -239,20 +239,11 @@ impl TcpStream { } pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> { - setsockopt(&self.inner, c::IPPROTO_TCP, c::TCP_NODELAY, nodelay as c_int) + self.inner.set_nodelay(nodelay) } pub fn nodelay(&self) -> io::Result { - let raw: c_int = try!(getsockopt(&self.inner, c::IPPROTO_TCP, c::TCP_NODELAY)); - Ok(raw != 0) - } - - pub fn set_keepalive(&self, keepalive: Option) -> io::Result<()> { - self.inner.set_keepalive(keepalive) - } - - pub fn keepalive(&self) -> io::Result> { - self.inner.keepalive() + self.inner.nodelay() } pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { -- cgit 1.4.1-3-g733a5