diff --git a/doc/api/http2.md b/doc/api/http2.md index bb0ac52dd8fa7b..640776f5e86dd0 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -903,8 +903,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 9bde444bdd20d4..524729a014eaa2 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -2452,7 +2452,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()) {