Skip to content

Commit

Permalink
fixup! http2: wait for session to finish writing before destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
lundibundi committed Dec 8, 2019
1 parent 71ef973 commit ac665ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node_http2.cc
Expand Up @@ -766,6 +766,7 @@ void Http2Session::Close(uint32_t code, bool socket_closed) {
// If we are writing we will get to make the callback in OnStreamAfterWrite.
if ((flags_ & SESSION_STATE_WRITE_IN_PROGRESS) == 0) {
Debug(this, "make done session callback");
HandleScope scope(env()->isolate());
MakeCallback(env()->ondone_string(), 0, nullptr);
if (stream_ != nullptr) stream_->ReadStart();
}
Expand Down Expand Up @@ -1569,12 +1570,12 @@ void Http2Session::OnStreamAfterWrite(WriteWrap* w, int status) {
!(flags_ & SESSION_STATE_WRITE_IN_PROGRESS) &&
(nghttp2_session_want_read(session_) ||
(flags_ & SESSION_STATE_CLOSED) != 0)) {
Debug(this, "OnStreamAfterWrite read start");
flags_ &= ~SESSION_STATE_READING_STOPPED;
stream_->ReadStart();
}

if ((flags_ & SESSION_STATE_CLOSED) != 0) {
HandleScope scope(env()->isolate());
MakeCallback(env()->ondone_string(), 0, nullptr);
return;
}
Expand Down

0 comments on commit ac665ae

Please sign in to comment.