http2: be sure to destroy the Http2Stream
PR-URL: https://github.com/nodejs/node/pull/17406 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit is contained in:
parent
ce38c49fb8
commit
18ca0b6442
@ -619,13 +619,16 @@ inline int Http2Session::OnStreamClose(nghttp2_session* handle,
|
|||||||
if (stream != nullptr) {
|
if (stream != nullptr) {
|
||||||
stream->Close(code);
|
stream->Close(code);
|
||||||
// It is possible for the stream close to occur before the stream is
|
// It is possible for the stream close to occur before the stream is
|
||||||
// ever passed on to the javascript side. If that happens, ignore this.
|
// ever passed on to the javascript side. If that happens, skip straight
|
||||||
|
// to destroying the stream
|
||||||
Local<Value> fn =
|
Local<Value> fn =
|
||||||
stream->object()->Get(context, env->onstreamclose_string())
|
stream->object()->Get(context, env->onstreamclose_string())
|
||||||
.ToLocalChecked();
|
.ToLocalChecked();
|
||||||
if (fn->IsFunction()) {
|
if (fn->IsFunction()) {
|
||||||
Local<Value> argv[1] = { Integer::NewFromUnsigned(isolate, code) };
|
Local<Value> argv[1] = { Integer::NewFromUnsigned(isolate, code) };
|
||||||
stream->MakeCallback(fn.As<Function>(), arraysize(argv), argv);
|
stream->MakeCallback(fn.As<Function>(), arraysize(argv), argv);
|
||||||
|
} else {
|
||||||
|
stream->Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user