Skip to content

Commit

Permalink
http2: be sure to destroy the Http2Stream
Browse files Browse the repository at this point in the history
Backport-PR-URL: #20456
PR-URL: #17406
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>

Backport-PR-URL: #18050
  • Loading branch information
jasnell authored and MylesBorins committed May 2, 2018
1 parent 8431b42 commit 1d65f2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,16 @@ inline int Http2Session::OnStreamClose(nghttp2_session* handle,
if (stream != nullptr) {
stream->Close(code);
// 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 =
stream->object()->Get(context, env->onstreamclose_string())
.ToLocalChecked();
if (fn->IsFunction()) {
Local<Value> argv[1] = { Integer::NewFromUnsigned(isolate, code) };
stream->MakeCallback(fn.As<Function>(), arraysize(argv), argv);
} else {
stream->Destroy();
}
}
return 0;
Expand Down

0 comments on commit 1d65f2b

Please sign in to comment.