Skip to content

Commit 56a834a

Browse files
mildsunriseBethGriggs
authored andcommitted
doc,test: clarify that Http2Stream is destroyed after data is read
Correct docs to clarify that behaviour, and fix a race condition in test-http2-large-write-destroy.js. Fixes: #27863 Backport-PR-URL: #28904 PR-URL: #27891 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 7f48519 commit 56a834a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/api/http2.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,9 @@ the value is `undefined`, the stream is not yet ready for use.
902902

903903
All [`Http2Stream`][] instances are destroyed either when:
904904

905-
* An `RST_STREAM` frame for the stream is received by the connected peer.
906-
* The `http2stream.close()` method is called.
905+
* An `RST_STREAM` frame for the stream is received by the connected peer,
906+
and pending data has been read.
907+
* The `http2stream.close()` method is called, and pending data has been read.
907908
* The `http2stream.destroy()` or `http2session.destroy()` methods are called.
908909

909910
When an `Http2Stream` instance is destroyed, an attempt will be made to send an

test/parallel/test-http2-large-write-destroy.js

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ server.listen(0, common.mustCall(() => {
3232

3333
const req = client.request({ ':path': '/' });
3434
req.end();
35+
req.resume(); // Otherwise close won't be emitted if there's pending data.
3536

3637
req.on('close', common.mustCall(() => {
3738
client.close();

0 commit comments

Comments
 (0)