mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
Change a return value of reactor::poll to io::Result.
This commit is contained in:
+6
-7
@@ -182,7 +182,7 @@ impl Core {
|
|||||||
return Ok(e)
|
return Ok(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
future_fired = self.poll(None);
|
future_fired = self.poll(None).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,17 +195,16 @@ impl Core {
|
|||||||
/// `loop { lp.turn(None) }` is equivalent to calling `run` with an
|
/// `loop { lp.turn(None) }` is equivalent to calling `run` with an
|
||||||
/// empty future (one that never finishes).
|
/// empty future (one that never finishes).
|
||||||
pub fn turn(&mut self, max_wait: Option<Duration>) {
|
pub fn turn(&mut self, max_wait: Option<Duration>) {
|
||||||
self.poll(max_wait);
|
self.poll(max_wait).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poll(&mut self, max_wait: Option<Duration>) -> bool {
|
fn poll(&mut self, max_wait: Option<Duration>) -> io::Result<bool> {
|
||||||
// Block waiting for an event to happen, peeling out how many events
|
// Block waiting for an event to happen, peeling out how many events
|
||||||
// happened.
|
// happened.
|
||||||
match self.inner.io.poll(&mut self.events, max_wait) {
|
match self.inner.io.poll(&mut self.events, max_wait) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(ref e) if e.kind() == ErrorKind::Interrupted => return false,
|
Err(ref e) if e.kind() == ErrorKind::Interrupted => return Ok(false),
|
||||||
// TODO: This should return an io::Result instead of panic.
|
Err(e) => return Err(e),
|
||||||
Err(e) => panic!("error in poll: {}", e),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process all the events that came in, dispatching appropriately
|
// Process all the events that came in, dispatching appropriately
|
||||||
@@ -223,7 +222,7 @@ impl Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fired
|
return Ok(fired)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch(&mut self, token: mio::Token, ready: mio::Ready) {
|
fn dispatch(&mut self, token: mio::Token, ready: mio::Ready) {
|
||||||
|
|||||||
Reference in New Issue
Block a user