diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-02-12 18:51:45 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-02-12 21:51:45 -0500 |
commit | 163c334521cd9da44f421764a08a4d4285b38ba8 (patch) | |
tree | 21c8bb3cfe1b07fbc9bc47c69373f57db7e5b05e | |
parent | f29c40a43306ae23c848231ba71c94b12a8b06ee (diff) |
Drop assert!() from untrack_task() (#1757)
-rw-r--r-- | src/resources.rs | 3 | ||||
-rw-r--r-- | src/tokio_util.rs | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/resources.rs b/src/resources.rs index 59167275b..6a15e378c 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -202,7 +202,8 @@ impl Resource { let mut table = RESOURCE_TABLE.lock().unwrap(); // Only untrack if is TcpListener. if let Some(Repr::TcpListener(_, t)) = table.get_mut(&self.rid) { - assert!(t.is_some()); + // DO NOT assert is_some here. + // See reasoning in Accept::poll(). t.take(); } } diff --git a/src/tokio_util.rs b/src/tokio_util.rs index 5322f2955..3dddff9c2 100644 --- a/src/tokio_util.rs +++ b/src/tokio_util.rs @@ -69,6 +69,10 @@ impl Future for Accept { // notified to error out (instead of stuck forever). AcceptState::Pending(ref mut r) => match r.poll_accept() { Ok(futures::prelude::Async::Ready(t)) => { + // Notice: it is possible to be Ready on the first poll. + // When eager accept fails due to WouldBlock, + // a next poll() might still be immediately Ready. + // See https://github.com/denoland/deno/issues/1756. r.untrack_task(); t } |