summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-05-23 23:01:20 +0530
committerGitHub <noreply@github.com>2024-05-23 23:01:20 +0530
commite450c6b7cb23be95862d48ef047490490391c9d9 (patch)
treed611ba4aa0f5922d144f4f67adf26a876b086e7a /ext/node/polyfills
parent0a30897925fd8940884231b97474f4ea76e5ed28 (diff)
fix(ext/node): return cancelled flag in get_response_body_chunk op (#23962)
The flag lets us exit from read loop without throwing an error when the stream is cancelled. This fixes gRPC cancellation example. Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/node/polyfills')
-rw-r--r--ext/node/polyfills/http2.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts
index 59756dd0f..c47e54d1b 100644
--- a/ext/node/polyfills/http2.ts
+++ b/ext/node/polyfills/http2.ts
@@ -1007,9 +1007,14 @@ export class ClientHttp2Stream extends Duplex {
debugHttp2(">>> read");
(async () => {
- const [chunk, finished] = await op_http2_client_get_response_body_chunk(
- this[kDenoResponse].bodyRid,
- );
+ const [chunk, finished, cancelled] =
+ await op_http2_client_get_response_body_chunk(
+ this[kDenoResponse].bodyRid,
+ );
+
+ if (cancelled) {
+ return;
+ }
debugHttp2(">>> chunk", chunk, finished, this[kDenoResponse].bodyRid);
if (chunk === null) {