From ac665aecf0be75b995bd770bc1d5f2fc984788fb Mon Sep 17 00:00:00 2001 From: Denys Otrishko Date: Sun, 8 Dec 2019 19:25:01 +0200 Subject: [PATCH] fixup! http2: wait for session to finish writing before destroy --- src/node_http2.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index f7252dcda7bbc3..537d29feac89be 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -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(); } @@ -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; }