summaryrefslogtreecommitdiffstats
path: root/tokio/src/io/registration.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/io/registration.rs')
-rw-r--r--tokio/src/io/registration.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/tokio/src/io/registration.rs b/tokio/src/io/registration.rs
index ce6cffda..0b166490 100644
--- a/tokio/src/io/registration.rs
+++ b/tokio/src/io/registration.rs
@@ -117,18 +117,23 @@ impl Registration {
cx: &mut Context<'_>,
direction: Direction,
) -> Poll<io::Result<ReadyEvent>> {
- if self.handle.inner().is_none() {
- return Poll::Ready(Err(io::Error::new(io::ErrorKind::Other, "reactor gone")));
- }
-
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
let ev = ready!(self.shared.poll_readiness(cx, direction));
+
+ if self.handle.inner().is_none() {
+ return Poll::Ready(Err(gone()));
+ }
+
coop.made_progress();
Poll::Ready(Ok(ev))
}
}
+fn gone() -> io::Error {
+ io::Error::new(io::ErrorKind::Other, "IO driver has terminated")
+}
+
cfg_io_readiness! {
impl Registration {
pub(super) async fn readiness(&self, interest: mio::Interest) -> io::Result<ReadyEvent> {