diff --git a/doc/api/http2.md b/doc/api/http2.md index 00837bfc0e413b..219a837c06d12f 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -927,8 +927,9 @@ the value is `undefined`, the stream is not yet ready for use. All [`Http2Stream`][] instances are destroyed either when: * An `RST_STREAM` frame for the stream is received by the connected peer, - and pending data has been read. -* The `http2stream.close()` method is called, and pending data has been read. + and (for client streams only) pending data has been read. +* The `http2stream.close()` method is called, and (for client streams only) + pending data has been read. * The `http2stream.destroy()` or `http2session.destroy()` methods are called. When an `Http2Stream` instance is destroyed, an attempt will be made to send an diff --git a/src/node_http2.cc b/src/node_http2.cc index 76ef72005a3087..566a1b7c55c3f5 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2367,7 +2367,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle, return NGHTTP2_ERR_DEFERRED; } - if (stream->queue_.empty() && !stream->IsWritable()) { + if (stream->available_outbound_length_ == 0 && !stream->IsWritable()) { Debug(session, "no more data for stream %d", id); *flags |= NGHTTP2_DATA_FLAG_EOF; if (stream->HasTrailers()) {