Skip to content

Commit 19359a6

Browse files
committed
Add _v4 suffix to (set_)freebind
To match the other IPv4 only socket methods.
1 parent d1ed4b8 commit 19359a6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/sys/unix.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,14 +2160,14 @@ impl crate::Socket {
21602160

21612161
/// Get the value of the `IP_FREEBIND` option on this socket.
21622162
///
2163-
/// For more information about this option, see [`set_freebind`].
2163+
/// For more information about this option, see [`set_freebind_v4`].
21642164
///
2165-
/// [`set_freebind`]: crate::Socket::set_freebind
2165+
/// [`set_freebind_v4`]: crate::Socket::set_freebind_v4
21662166
#[cfg(all(
21672167
feature = "all",
21682168
any(target_os = "android", target_os = "fuchsia", target_os = "linux")
21692169
))]
2170-
pub fn freebind(&self) -> io::Result<bool> {
2170+
pub fn freebind_v4(&self) -> io::Result<bool> {
21712171
unsafe {
21722172
getsockopt::<c_int>(self.as_raw(), libc::SOL_IP, libc::IP_FREEBIND)
21732173
.map(|freebind| freebind != 0)
@@ -2185,7 +2185,7 @@ impl crate::Socket {
21852185
feature = "all",
21862186
any(target_os = "android", target_os = "fuchsia", target_os = "linux")
21872187
))]
2188-
pub fn set_freebind(&self, freebind: bool) -> io::Result<()> {
2188+
pub fn set_freebind_v4(&self, freebind: bool) -> io::Result<()> {
21892189
unsafe {
21902190
setsockopt(
21912191
self.as_raw(),
@@ -2200,9 +2200,9 @@ impl crate::Socket {
22002200
///
22012201
/// This is an IPv6 counterpart of `IP_FREEBIND` socket option on
22022202
/// Android/Linux. For more information about this option, see
2203-
/// [`set_freebind`].
2203+
/// [`set_freebind_v4`].
22042204
///
2205-
/// [`set_freebind`]: crate::Socket::set_freebind
2205+
/// [`set_freebind_v4`]: crate::Socket::set_freebind_v4
22062206
#[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))]
22072207
pub fn freebind_ipv6(&self) -> io::Result<bool> {
22082208
unsafe {
@@ -2215,9 +2215,9 @@ impl crate::Socket {
22152215
///
22162216
/// This is an IPv6 counterpart of `IP_FREEBIND` socket option on
22172217
/// Android/Linux. For more information about this option, see
2218-
/// [`set_freebind`].
2218+
/// [`set_freebind_v4`].
22192219
///
2220-
/// [`set_freebind`]: crate::Socket::set_freebind
2220+
/// [`set_freebind_v4`]: crate::Socket::set_freebind_v4
22212221
///
22222222
/// # Examples
22232223
///
@@ -2229,7 +2229,7 @@ impl crate::Socket {
22292229
///
22302230
/// fn enable_freebind(socket: &Socket) -> io::Result<()> {
22312231
/// match socket.domain()? {
2232-
/// Domain::IPV4 => socket.set_freebind(true)?,
2232+
/// Domain::IPV4 => socket.set_freebind_v4(true)?,
22332233
/// Domain::IPV6 => socket.set_freebind_ipv6(true)?,
22342234
/// _ => return Err(Error::new(ErrorKind::Other, "unsupported domain")),
22352235
/// };

tests/socket.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ test!(
14201420
);
14211421
test!(keepalive, set_keepalive(true));
14221422
#[cfg(all(feature = "all", any(target_os = "fuchsia", target_os = "linux")))]
1423-
test!(freebind, set_freebind(true));
1423+
test!(freebind_v4, set_freebind_v4(true));
14241424
#[cfg(all(feature = "all", target_os = "linux"))]
14251425
test!(IPv6 freebind_ipv6, set_freebind_ipv6(true));
14261426

0 commit comments

Comments
 (0)