1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

fix(ext/node): check resource exists before close (#23655)

This commit is contained in:
Satya Rohith 2024-05-02 18:34:42 +05:30 committed by GitHub
parent 56ba7f3c23
commit 811280af77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1015,7 +1015,7 @@ export class ClientHttp2Stream extends Duplex {
this.emit("trailers", trailers); this.emit("trailers", trailers);
} }
debugHttp2("tryClose"); debugHttp2(">>> tryClose", this[kDenoResponse]?.bodyRid);
core.tryClose(this[kDenoResponse].bodyRid); core.tryClose(this[kDenoResponse].bodyRid);
this.push(null); this.push(null);
debugHttp2(">>> read null chunk"); debugHttp2(">>> read null chunk");
@ -1246,10 +1246,12 @@ function finishCloseStream(stream, code) {
debugHttp2( debugHttp2(
">>> finishCloseStream close", ">>> finishCloseStream close",
stream[kDenoRid], stream[kDenoRid],
stream[kDenoResponse].bodyRid, stream[kDenoResponse]?.bodyRid,
); );
core.tryClose(stream[kDenoRid]); core.tryClose(stream[kDenoRid]);
core.tryClose(stream[kDenoResponse].bodyRid); if (stream[kDenoResponse]) {
core.tryClose(stream[kDenoResponse].bodyRid);
}
stream.emit("close"); stream.emit("close");
}); });
}); });
@ -1265,7 +1267,9 @@ function finishCloseStream(stream, code) {
stream[kDenoResponse].bodyRid, stream[kDenoResponse].bodyRid,
); );
core.tryClose(stream[kDenoRid]); core.tryClose(stream[kDenoRid]);
core.tryClose(stream[kDenoResponse].bodyRid); if (stream[kDenoResponse]) {
core.tryClose(stream[kDenoResponse].bodyRid);
}
nextTick(() => { nextTick(() => {
stream.emit("close"); stream.emit("close");
}); });
@ -1273,10 +1277,12 @@ function finishCloseStream(stream, code) {
debugHttp2( debugHttp2(
">>> finishCloseStream close2 catch", ">>> finishCloseStream close2 catch",
stream[kDenoRid], stream[kDenoRid],
stream[kDenoResponse].bodyRid, stream[kDenoResponse]?.bodyRid,
); );
core.tryClose(stream[kDenoRid]); core.tryClose(stream[kDenoRid]);
core.tryClose(stream[kDenoResponse].bodyRid); if (stream[kDenoResponse]) {
core.tryClose(stream[kDenoResponse].bodyRid);
}
nextTick(() => { nextTick(() => {
stream.emit("close"); stream.emit("close");
}); });