Skip to content

Commit 798ce50

Browse files
committed
std: Deprecate extra TcpStream/UdpSocket methods
These methods are all covered by [RFC 1158] and are currently all available on stable Rust via the [`net2` crate][net2] on crates.io. This commit does not touch the timeout related functions as they're still waiting on `Duration` which is unstable anyway, so punting in favor of the `net2` crate wouldn't buy much. [RFC 1158]: rust-lang/rfcs#1158 [net2]: http://crates.io/crates/net2 Specifically, this commit deprecates: * TcpStream::set_nodelay * TcpStream::set_keepalive * UdpSocket::set_broadcast * UdpSocket::set_multicast_loop * UdpSocket::join_multicast * UdpSocket::set_multicast_time_to_live * UdpSocket::set_time_to_live
1 parent ba9224f commit 798ce50

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/libstd/net/tcp.rs

+6
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ impl TcpStream {
129129
}
130130

131131
/// Sets the nodelay flag on this connection to the boolean specified.
132+
#[deprecated(since = "1.3.0",
133+
reason = "available through the `net2` crate on crates.io")]
134+
#[unstable(feature = "tcp_extras", reason = "available externally")]
132135
pub fn set_nodelay(&self, nodelay: bool) -> io::Result<()> {
133136
self.0.set_nodelay(nodelay)
134137
}
@@ -138,6 +141,9 @@ impl TcpStream {
138141
/// If the value specified is `None`, then the keepalive flag is cleared on
139142
/// this connection. Otherwise, the keepalive timeout will be set to the
140143
/// specified time, in seconds.
144+
#[unstable(feature = "tcp_extras", reason = "available externally")]
145+
#[deprecated(since = "1.3.0",
146+
reason = "available through the `net2` crate on crates.io")]
141147
pub fn set_keepalive(&self, seconds: Option<u32>) -> io::Result<()> {
142148
self.0.set_keepalive(seconds)
143149
}

src/libstd/net/udp.rs

+18
Original file line numberDiff line numberDiff line change
@@ -98,33 +98,51 @@ impl UdpSocket {
9898
}
9999

100100
/// Sets the broadcast flag on or off.
101+
#[deprecated(since = "1.3.0",
102+
reason = "available through the `net2` crate on crates.io")]
103+
#[unstable(feature = "udp_extras", reason = "available externally")]
101104
pub fn set_broadcast(&self, on: bool) -> io::Result<()> {
102105
self.0.set_broadcast(on)
103106
}
104107

105108
/// Sets the multicast loop flag to the specified value.
106109
///
107110
/// This lets multicast packets loop back to local sockets (if enabled)
111+
#[deprecated(since = "1.3.0",
112+
reason = "available through the `net2` crate on crates.io")]
113+
#[unstable(feature = "udp_extras", reason = "available externally")]
108114
pub fn set_multicast_loop(&self, on: bool) -> io::Result<()> {
109115
self.0.set_multicast_loop(on)
110116
}
111117

112118
/// Joins a multicast IP address (becomes a member of it).
119+
#[deprecated(since = "1.3.0",
120+
reason = "available through the `net2` crate on crates.io")]
121+
#[unstable(feature = "udp_extras", reason = "available externally")]
113122
pub fn join_multicast(&self, multi: &IpAddr) -> io::Result<()> {
114123
self.0.join_multicast(multi)
115124
}
116125

117126
/// Leaves a multicast IP address (drops membership from it).
127+
#[deprecated(since = "1.3.0",
128+
reason = "available through the `net2` crate on crates.io")]
129+
#[unstable(feature = "udp_extras", reason = "available externally")]
118130
pub fn leave_multicast(&self, multi: &IpAddr) -> io::Result<()> {
119131
self.0.leave_multicast(multi)
120132
}
121133

122134
/// Sets the multicast TTL.
135+
#[deprecated(since = "1.3.0",
136+
reason = "available through the `net2` crate on crates.io")]
137+
#[unstable(feature = "udp_extras", reason = "available externally")]
123138
pub fn set_multicast_time_to_live(&self, ttl: i32) -> io::Result<()> {
124139
self.0.multicast_time_to_live(ttl)
125140
}
126141

127142
/// Sets this socket's TTL.
143+
#[deprecated(since = "1.3.0",
144+
reason = "available through the `net2` crate on crates.io")]
145+
#[unstable(feature = "udp_extras", reason = "available externally")]
128146
pub fn set_time_to_live(&self, ttl: i32) -> io::Result<()> {
129147
self.0.time_to_live(ttl)
130148
}

0 commit comments

Comments
 (0)