Skip to content

Commit 171d1eb

Browse files
committed
Suffix Socket::(set_)recv_tos with v4
To indicate it an option for IPv4 sockets.
1 parent 11428df commit 171d1eb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/socket.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ impl Socket {
16071607
target_os = "espidf",
16081608
target_os = "vita",
16091609
)))]
1610-
pub fn set_recv_tos(&self, recv_tos: bool) -> io::Result<()> {
1610+
pub fn set_recv_tos_v4(&self, recv_tos: bool) -> io::Result<()> {
16111611
unsafe {
16121612
setsockopt(
16131613
self.as_raw(),
@@ -1620,9 +1620,9 @@ impl Socket {
16201620

16211621
/// Get the value of the `IP_RECVTOS` option for this socket.
16221622
///
1623-
/// For more information about this option, see [`set_recv_tos`].
1623+
/// For more information about this option, see [`set_recv_tos_v4`].
16241624
///
1625-
/// [`set_recv_tos`]: Socket::set_recv_tos
1625+
/// [`set_recv_tos_v4`]: Socket::set_recv_tos_v4
16261626
#[cfg(not(any(
16271627
target_os = "aix",
16281628
target_os = "dragonfly",
@@ -1638,7 +1638,7 @@ impl Socket {
16381638
target_os = "espidf",
16391639
target_os = "vita",
16401640
)))]
1641-
pub fn recv_tos(&self) -> io::Result<bool> {
1641+
pub fn recv_tos_v4(&self) -> io::Result<bool> {
16421642
unsafe {
16431643
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IP, sys::IP_RECVTOS)
16441644
.map(|recv_tos| recv_tos > 0)

tests/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ test!(IPv4 tos_v4, set_tos_v4(96));
14251425
target_os = "vita",
14261426
target_os = "haiku",
14271427
)))]
1428-
test!(IPv4 recv_tos, set_recv_tos(true));
1428+
test!(IPv4 recv_tos_v4, set_recv_tos_v4(true));
14291429

14301430
#[cfg(not(windows))] // TODO: returns `WSAENOPROTOOPT` (10042) on Windows.
14311431
test!(IPv4 broadcast, set_broadcast(true));

0 commit comments

Comments
 (0)