Skip to content

Commit 819716c

Browse files
committed
Remove all feature from Socket::{recv, send}_out_of_band
Available on all three major OSes.
1 parent cb2c728 commit 819716c

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

src/socket.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ impl Socket {
295295
///
296296
/// [`recv`]: Socket::recv
297297
/// [`out_of_band_inline`]: Socket::out_of_band_inline
298-
#[cfg(feature = "all")]
299298
pub fn recv_out_of_band(&self, buf: &mut [u8]) -> io::Result<usize> {
300299
self.recv_with_flags(buf, sys::MSG_OOB)
301300
}
@@ -443,7 +442,6 @@ impl Socket {
443442
///
444443
/// [`send`]: #method.send
445444
/// [`out_of_band_inline`]: #method.out_of_band_inline
446-
#[cfg(feature = "all")]
447445
pub fn send_out_of_band(&self, buf: &[u8]) -> io::Result<usize> {
448446
self.send_with_flags(buf, sys::MSG_OOB)
449447
}

src/sys/unix.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ pub(crate) use libc::{
5454
#[cfg(not(target_os = "redox"))]
5555
pub(crate) use libc::MSG_TRUNC;
5656
// Used in `Socket`.
57-
#[cfg(feature = "all")]
58-
pub(crate) use libc::MSG_OOB;
5957
pub(crate) use libc::{
6058
ip_mreq as IpMreq, ipv6_mreq as Ipv6Mreq, linger, IPPROTO_IP, IPPROTO_IPV6,
6159
IPV6_MULTICAST_HOPS, IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP, IPV6_UNICAST_HOPS, IPV6_V6ONLY,
6260
IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_IF, IP_MULTICAST_LOOP, IP_MULTICAST_TTL,
63-
IP_TTL, MSG_PEEK, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE,
64-
SO_RCVBUF, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDBUF, SO_SNDTIMEO, TCP_NODELAY,
61+
IP_TTL, MSG_OOB, MSG_PEEK, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_KEEPALIVE, SO_LINGER,
62+
SO_OOBINLINE, SO_RCVBUF, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDBUF, SO_SNDTIMEO, TCP_NODELAY,
6563
};
6664
#[cfg(not(any(
6765
target_os = "dragonfly",

src/sys/windows.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ pub(crate) use winapi::shared::ws2ipdef::{
6666
IP_DROP_MEMBERSHIP, IP_MREQ as IpMreq, IP_MULTICAST_IF, IP_MULTICAST_LOOP, IP_MULTICAST_TTL,
6767
IP_TTL,
6868
};
69-
#[cfg(all(windows, feature = "all"))]
70-
pub(crate) use winapi::um::winsock2::MSG_OOB;
71-
pub(crate) use winapi::um::winsock2::{linger, MSG_PEEK};
69+
pub(crate) use winapi::um::winsock2::{linger, MSG_OOB, MSG_PEEK};
7270
pub(crate) const IPPROTO_IPV6: c_int = winapi::shared::ws2def::IPPROTO_IPV6 as c_int;
7371

7472
/// Type used in set/getsockopt to retrieve the `TCP_NODELAY` option.

tests/socket.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ use std::io::Read;
77
use std::io::Write;
88
#[cfg(not(target_os = "redox"))]
99
use std::io::{IoSlice, IoSliceMut};
10-
#[cfg(feature = "all")]
11-
use std::net::{Ipv4Addr, SocketAddrV4};
12-
use std::net::{Ipv6Addr, SocketAddr, SocketAddrV6};
10+
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
1311
#[cfg(unix)]
1412
use std::os::unix::io::AsRawFd;
1513
#[cfg(windows)]
1614
use std::os::windows::io::AsRawSocket;
1715
use std::str;
18-
#[cfg(feature = "all")]
1916
use std::thread;
2017
use std::time::Duration;
2118
#[cfg(all(unix, feature = "all"))]
@@ -28,9 +25,7 @@ use winapi::um::handleapi::GetHandleInformation;
2825
#[cfg(windows)]
2926
use winapi::um::winbase::HANDLE_FLAG_INHERIT;
3027

31-
#[cfg(feature = "all")]
32-
use socket2::SockAddr;
33-
use socket2::{Domain, Protocol, Socket, TcpKeepalive, Type};
28+
use socket2::{Domain, Protocol, SockAddr, Socket, TcpKeepalive, Type};
3429

3530
#[test]
3631
fn domain_for_address() {
@@ -305,7 +300,6 @@ where
305300
assert_eq!(flags, want as _, "non-blocking option");
306301
}
307302

308-
#[cfg(feature = "all")]
309303
const DATA: &[u8] = b"hello world";
310304

311305
#[test]
@@ -346,7 +340,6 @@ fn unix() {
346340
}
347341

348342
#[test]
349-
#[cfg(feature = "all")]
350343
fn out_of_band() {
351344
let listener = Socket::new(Domain::IPV4, Type::STREAM, None).unwrap();
352345
listener.bind(&any_ipv4()).unwrap();
@@ -646,7 +639,6 @@ fn device() {
646639
}
647640
}
648641

649-
#[cfg(feature = "all")]
650642
fn any_ipv4() -> SockAddr {
651643
SocketAddrV4::new(Ipv4Addr::LOCALHOST, 0).into()
652644
}

0 commit comments

Comments
 (0)