Skip to content

Commit 6cc785e

Browse files
fix: match name with the std's & socket2's set_nonblocking
1 parent 5c08a3a commit 6cc785e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/smol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct SmolSocket(Async<Socket>);
2020
impl FromRawFd for SmolSocket {
2121
unsafe fn from_raw_fd(fd: RawFd) -> Self {
2222
let socket = Socket::from_raw_fd(fd);
23-
socket.set_non_blocking(true).unwrap();
23+
socket.set_nonblocking(true).unwrap();
2424
SmolSocket(Async::new(socket).unwrap())
2525
}
2626
}

src/socket.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ impl Socket {
137137
// when building with --features smol we don't need this
138138
#[allow(dead_code)]
139139
/// Make this socket non-blocking
140-
pub fn set_non_blocking(&self, non_blocking: bool) -> Result<()> {
141-
let mut non_blocking = non_blocking as libc::c_int;
140+
pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()> {
141+
let mut nonblocking = nonblocking as libc::c_int;
142142
let res = unsafe {
143-
libc::ioctl(self.as_raw_fd(), libc::FIONBIO, &mut non_blocking)
143+
libc::ioctl(self.as_raw_fd(), libc::FIONBIO, &mut nonblocking)
144144
};
145145
if res < 0 {
146146
return Err(Error::last_os_error());
@@ -689,10 +689,10 @@ mod test {
689689
}
690690

691691
#[test]
692-
fn set_non_blocking() {
692+
fn set_nonblocking() {
693693
let sock = Socket::new(NETLINK_ROUTE).unwrap();
694-
sock.set_non_blocking(true).unwrap();
695-
sock.set_non_blocking(false).unwrap();
694+
sock.set_nonblocking(true).unwrap();
695+
sock.set_nonblocking(false).unwrap();
696696
}
697697

698698
#[test]

src/tokio.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct TokioSocket(AsyncFd<Socket>);
1818
impl FromRawFd for TokioSocket {
1919
unsafe fn from_raw_fd(fd: RawFd) -> Self {
2020
let socket = Socket::from_raw_fd(fd);
21-
socket.set_non_blocking(true).unwrap();
21+
socket.set_nonblocking(true).unwrap();
2222
TokioSocket(AsyncFd::new(socket).unwrap())
2323
}
2424
}
@@ -41,7 +41,7 @@ impl AsyncSocket for TokioSocket {
4141

4242
fn new(protocol: isize) -> io::Result<Self> {
4343
let socket = Socket::new(protocol)?;
44-
socket.set_non_blocking(true)?;
44+
socket.set_nonblocking(true)?;
4545
Ok(Self(AsyncFd::new(socket)?))
4646
}
4747

0 commit comments

Comments
 (0)