Rename the `nonblocking` method to `is_nonblocking`
We used to use `is_nonblocking()` in TCP streams, but use `nonblocking()` in UDP datagrams. Since `is_nonblocking()` is generally preferred, this commit renames `nonblocking()` to `is_nonblocking()` in UDP datagrams.
This commit is contained in:
parent
14ee9c2dc7
commit
246d8521f2
|
|
@ -157,7 +157,7 @@ impl DatagramSocket {
|
|||
))
|
||||
}
|
||||
|
||||
pub fn nonblocking(&self) -> bool {
|
||||
pub fn is_nonblocking(&self) -> bool {
|
||||
self.nonblocking.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ impl FileLike for DatagramSocket {
|
|||
}
|
||||
|
||||
fn status_flags(&self) -> StatusFlags {
|
||||
if self.nonblocking() {
|
||||
if self.is_nonblocking() {
|
||||
StatusFlags::O_NONBLOCK
|
||||
} else {
|
||||
StatusFlags::empty()
|
||||
|
|
@ -254,7 +254,7 @@ impl Socket for DatagramSocket {
|
|||
}
|
||||
let events = self.inner.read().poll(IoEvents::IN, Some(&poller));
|
||||
if !events.contains(IoEvents::IN) {
|
||||
if self.nonblocking() {
|
||||
if self.is_nonblocking() {
|
||||
return_errno_with_message!(Errno::EAGAIN, "try to receive again");
|
||||
}
|
||||
// FIXME: deal with recvfrom timeout
|
||||
|
|
|
|||
Loading…
Reference in New Issue