diff --git a/src/node_http2.cc b/src/node_http2.cc index a56f0ebccf768d..e0d6398f2a44a9 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -1979,6 +1979,12 @@ void Http2Stream::Close(int32_t code) { Debug(this, "closed with code %d", code); } +ShutdownWrap* Http2Stream::CreateShutdownWrap(v8::Local object) { + // DoShutdown() always finishes synchronously, so there's no need to create + // a structure to store asynchronous context. + return nullptr; +} + int Http2Stream::DoShutdown(ShutdownWrap* req_wrap) { if (IsDestroyed()) return UV_EPIPE; diff --git a/src/node_http2.h b/src/node_http2.h index 4605aab247687c..7ef7fcfd6bfc78 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -470,6 +470,7 @@ class Http2Stream : public AsyncWrap, int ReadStop() override; // Required for StreamBase + ShutdownWrap* CreateShutdownWrap(v8::Local object) override; int DoShutdown(ShutdownWrap* req_wrap) override; bool HasWantsWrite() const override { return true; } diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 65af037d152763..f89eb3a5287939 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -162,7 +162,7 @@ inline int StreamBase::Shutdown(v8::Local req_wrap_obj) { ShutdownWrap* req_wrap = CreateShutdownWrap(req_wrap_obj); int err = DoShutdown(req_wrap); - if (err != 0) { + if (err != 0 && req_wrap != nullptr) { req_wrap->Dispose(); }