Skip to content

Commit f2c3b95

Browse files
committed
Suffix Socket::(set_)recv_tos with v4
To indicate it an option for IPv4 sockets.
1 parent 3e8bee4 commit f2c3b95

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
@@ -1632,7 +1632,7 @@ impl Socket {
16321632
target_os = "espidf",
16331633
target_os = "vita",
16341634
)))]
1635-
pub fn set_recv_tos(&self, recv_tos: bool) -> io::Result<()> {
1635+
pub fn set_recv_tos_v4(&self, recv_tos: bool) -> io::Result<()> {
16361636
unsafe {
16371637
setsockopt(
16381638
self.as_raw(),
@@ -1645,9 +1645,9 @@ impl Socket {
16451645

16461646
/// Get the value of the `IP_RECVTOS` option for this socket.
16471647
///
1648-
/// For more information about this option, see [`set_recv_tos`].
1648+
/// For more information about this option, see [`set_recv_tos_v4`].
16491649
///
1650-
/// [`set_recv_tos`]: Socket::set_recv_tos
1650+
/// [`set_recv_tos_v4`]: Socket::set_recv_tos_v4
16511651
#[cfg(not(any(
16521652
target_os = "aix",
16531653
target_os = "dragonfly",
@@ -1663,7 +1663,7 @@ impl Socket {
16631663
target_os = "espidf",
16641664
target_os = "vita",
16651665
)))]
1666-
pub fn recv_tos(&self) -> io::Result<bool> {
1666+
pub fn recv_tos_v4(&self) -> io::Result<bool> {
16671667
unsafe {
16681668
getsockopt::<c_int>(self.as_raw(), sys::IPPROTO_IP, sys::IP_RECVTOS)
16691669
.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)