diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-08-11 17:27:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-12 14:55:17 -0700 |
| commit | 8d90d3f36871a00023cc1f313f91e351c287ca15 (patch) | |
| tree | 2d9b616a2468117aa3afe1f6b1f910ff3116776b /src/libstd/sys/common/net.rs | |
| parent | d07d465cf60033e35eba16b9e431471d54c712f4 (diff) | |
| download | rust-8d90d3f36871a00023cc1f313f91e351c287ca15.tar.gz rust-8d90d3f36871a00023cc1f313f91e351c287ca15.zip | |
Remove all unstable deprecated functionality
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
Diffstat (limited to 'src/libstd/sys/common/net.rs')
| -rw-r--r-- | src/libstd/sys/common/net.rs | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 6dd222b8f6e..68d5f49dffa 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -186,42 +186,6 @@ impl TcpStream { pub fn into_socket(self) -> Socket { self.inner } - pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> { - setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_NODELAY, - nodelay as c_int) - } - - pub fn set_keepalive(&self, seconds: Option<u32>) -> io::Result<()> { - let ret = setsockopt(&self.inner, libc::SOL_SOCKET, libc::SO_KEEPALIVE, - seconds.is_some() as c_int); - match seconds { - Some(n) => ret.and_then(|()| self.set_tcp_keepalive(n)), - None => ret, - } - } - - #[cfg(any(target_os = "macos", target_os = "ios"))] - fn set_tcp_keepalive(&self, seconds: u32) -> io::Result<()> { - setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, - seconds as c_int) - } - #[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 = "linux")))] - fn set_tcp_keepalive(&self, _seconds: u32) -> io::Result<()> { - Ok(()) - } - pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> { self.inner.set_timeout(dur, libc::SO_RCVTIMEO) } @@ -431,65 +395,6 @@ impl UdpSocket { Ok(ret as usize) } - pub fn set_broadcast(&self, on: bool) -> io::Result<()> { - setsockopt(&self.inner, libc::SOL_SOCKET, libc::SO_BROADCAST, - on as c_int) - } - - pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> { - setsockopt(&self.inner, libc::IPPROTO_IP, - libc::IP_MULTICAST_LOOP, on as c_int) - } - - pub fn join_multicast(&self, multi: &IpAddr) -> io::Result<()> { - match *multi { - IpAddr::V4(..) => { - self.set_membership(multi, libc::IP_ADD_MEMBERSHIP) - } - IpAddr::V6(..) => { - self.set_membership(multi, libc::IPV6_ADD_MEMBERSHIP) - } - } - } - pub fn leave_multicast(&self, multi: &IpAddr) -> io::Result<()> { - match *multi { - IpAddr::V4(..) => { - self.set_membership(multi, libc::IP_DROP_MEMBERSHIP) - } - IpAddr::V6(..) => { - self.set_membership(multi, libc::IPV6_DROP_MEMBERSHIP) - } - } - } - fn set_membership(&self, addr: &IpAddr, opt: c_int) -> io::Result<()> { - match *addr { - IpAddr::V4(ref addr) => { - let mreq = libc::ip_mreq { - imr_multiaddr: *addr.as_inner(), - // interface == INADDR_ANY - imr_interface: libc::in_addr { s_addr: 0x0 }, - }; - setsockopt(&self.inner, libc::IPPROTO_IP, opt, mreq) - } - IpAddr::V6(ref addr) => { - let mreq = libc::ip6_mreq { - ipv6mr_multiaddr: *addr.as_inner(), - ipv6mr_interface: 0, - }; - setsockopt(&self.inner, libc::IPPROTO_IPV6, opt, mreq) - } - } - } - - pub fn multicast_time_to_live(&self, ttl: i32) -> io::Result<()> { - setsockopt(&self.inner, libc::IPPROTO_IP, libc::IP_MULTICAST_TTL, - ttl as c_int) - } - - pub fn time_to_live(&self, ttl: i32) -> io::Result<()> { - setsockopt(&self.inner, libc::IPPROTO_IP, libc::IP_TTL, ttl as c_int) - } - pub fn duplicate(&self) -> io::Result<UdpSocket> { self.inner.duplicate().map(|s| UdpSocket { inner: s }) } |
