diff --git a/src/node_http2_core-inl.h b/src/node_http2_core-inl.h index eda8a93ee79ff0..c78e5d673f41f4 100644 --- a/src/node_http2_core-inl.h +++ b/src/node_http2_core-inl.h @@ -503,7 +503,7 @@ inline void Nghttp2Session::SendPendingData() { while ((srcLength = nghttp2_session_mem_send(session_, &src)) > 0) { if (req == nullptr) { req = AllocateSend(); - destRemaining = req->self_size(); + destRemaining = req->ExtraSize(); dest = req->Extra(); } DEBUG_HTTP2("Nghttp2Session %s: nghttp2 has %d bytes to send\n", @@ -525,7 +525,7 @@ inline void Nghttp2Session::SendPendingData() { srcRemaining -= destRemaining; srcOffset += destRemaining; req = AllocateSend(); - destRemaining = req->self_size(); + destRemaining = req->ExtraSize(); dest = req->Extra(); } diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 667c0a9ffbd50d..e1e50802f2a06a 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -160,6 +160,10 @@ char* WriteWrap::Extra(size_t offset) { offset; } +size_t WriteWrap::ExtraSize() const { + return storage_size_ - ROUND_UP(sizeof(*this), kAlignSize); +} + } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS diff --git a/src/stream_base.h b/src/stream_base.h index 9833a82636d28e..20cb0155c9d7b9 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -77,6 +77,7 @@ class WriteWrap: public ReqWrap, size_t extra = 0); inline void Dispose(); inline char* Extra(size_t offset = 0); + inline size_t ExtraSize() const; inline StreamBase* wrap() const { return wrap_; }