Skip to content

Commit ac665ae

Browse files
committed
fixup! http2: wait for session to finish writing before destroy
1 parent 71ef973 commit ac665ae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_http2.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ void Http2Session::Close(uint32_t code, bool socket_closed) {
766766
// If we are writing we will get to make the callback in OnStreamAfterWrite.
767767
if ((flags_ & SESSION_STATE_WRITE_IN_PROGRESS) == 0) {
768768
Debug(this, "make done session callback");
769+
HandleScope scope(env()->isolate());
769770
MakeCallback(env()->ondone_string(), 0, nullptr);
770771
if (stream_ != nullptr) stream_->ReadStart();
771772
}
@@ -1569,12 +1570,12 @@ void Http2Session::OnStreamAfterWrite(WriteWrap* w, int status) {
15691570
!(flags_ & SESSION_STATE_WRITE_IN_PROGRESS) &&
15701571
(nghttp2_session_want_read(session_) ||
15711572
(flags_ & SESSION_STATE_CLOSED) != 0)) {
1572-
Debug(this, "OnStreamAfterWrite read start");
15731573
flags_ &= ~SESSION_STATE_READING_STOPPED;
15741574
stream_->ReadStart();
15751575
}
15761576

15771577
if ((flags_ & SESSION_STATE_CLOSED) != 0) {
1578+
HandleScope scope(env()->isolate());
15781579
MakeCallback(env()->ondone_string(), 0, nullptr);
15791580
return;
15801581
}

0 commit comments

Comments
 (0)