Skip to content

Commit

Permalink
http2: be sure to destroy the Http2Stream
Browse files Browse the repository at this point in the history
PR-URL: #17406
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>

Backport-PR-URL: #18050
  • Loading branch information
jasnell authored and MylesBorins committed Jan 10, 2018
1 parent 30e75e6 commit f699a74
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 f699a74

Please sign in to comment.