summaryrefslogtreecommitdiff
path: root/ext/http/response_body.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-05-16 17:00:59 -0600
committerGitHub <noreply@github.com>2023-05-16 17:00:59 -0600
commita22388bbd1377f75d3b873c59f6836cd12c2abe5 (patch)
tree04b9879ab7172884b3417fdf1a3d170564c54726 /ext/http/response_body.rs
parent9ba2c4c42fcbadea1f19c67c88b5cbc4c97804f3 (diff)
fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154)
Fixes for various `Attemped to access invalid request` bugs (#19058, #15427, #17213). We did not wait for both a drop event and a completion event before removing items from the slab table. This ensures that we do so. In addition, the slab methods are refactored out into `slab.rs` for maintainability.
Diffstat (limited to 'ext/http/response_body.rs')
-rw-r--r--ext/http/response_body.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/http/response_body.rs b/ext/http/response_body.rs
index 288d74758..e30c917c3 100644
--- a/ext/http/response_body.rs
+++ b/ext/http/response_body.rs
@@ -82,6 +82,10 @@ impl CompletionHandle {
waker.wake();
}
}
+
+ pub fn is_completed(&self) -> bool {
+ self.inner.borrow().complete
+ }
}
impl Future for CompletionHandle {