mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
Prefer ErrorKind::WouldBlock
This commit is contained in:
+3
-3
@@ -63,7 +63,7 @@ impl TcpListener {
|
||||
match pending.poll().expect("shouldn't be canceled") {
|
||||
Async::NotReady => {
|
||||
self.pending_accept = Some(pending);
|
||||
return Err(::would_block())
|
||||
return Err(io::ErrorKind::WouldBlock.into())
|
||||
},
|
||||
Async::Ready(r) => return r,
|
||||
}
|
||||
@@ -541,7 +541,7 @@ impl ::io::Io for TcpStream {
|
||||
|
||||
fn read_vec(&mut self, bufs: &mut [&mut IoVec]) -> io::Result<usize> {
|
||||
if let Async::NotReady = <TcpStream>::poll_read(self) {
|
||||
return Err(::would_block())
|
||||
return Err(io::ErrorKind::WouldBlock.into())
|
||||
}
|
||||
let r = self.io.get_ref().read_bufs(bufs);
|
||||
if is_wouldblock(&r) {
|
||||
@@ -552,7 +552,7 @@ impl ::io::Io for TcpStream {
|
||||
|
||||
fn write_vec(&mut self, bufs: &[&IoVec]) -> io::Result<usize> {
|
||||
if let Async::NotReady = <TcpStream>::poll_write(self) {
|
||||
return Err(::would_block())
|
||||
return Err(io::ErrorKind::WouldBlock.into())
|
||||
}
|
||||
let r = self.io.get_ref().write_bufs(bufs);
|
||||
if is_wouldblock(&r) {
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ impl UdpSocket {
|
||||
/// documentation for concrete examples.
|
||||
pub fn send_to(&self, buf: &[u8], target: &SocketAddr) -> io::Result<usize> {
|
||||
if let Async::NotReady = self.io.poll_write() {
|
||||
return Err(::would_block())
|
||||
return Err(io::ErrorKind::WouldBlock.into())
|
||||
}
|
||||
match self.io.get_ref().send_to(buf, target) {
|
||||
Ok(n) => Ok(n),
|
||||
@@ -145,7 +145,7 @@ impl UdpSocket {
|
||||
/// read and the address from whence the data came.
|
||||
pub fn recv_from(&self, buf: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
|
||||
if let Async::NotReady = self.io.poll_read() {
|
||||
return Err(::would_block())
|
||||
return Err(io::ErrorKind::WouldBlock.into())
|
||||
}
|
||||
match self.io.get_ref().recv_from(buf) {
|
||||
Ok(n) => Ok(n),
|
||||
|
||||
Reference in New Issue
Block a user