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: nodejs#17406
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
  • Loading branch information
jasnell committed Dec 18, 2017
1 parent ce38c49 commit 18ca0b6
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 18ca0b6

Please sign in to comment.