Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlba Mendez <me@alba.sh>2019-05-26 14:12:41 +0300
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2019-10-07 13:47:41 +0300
commit56a834a53f7e1651b2f5b7533da3b1df27bb8498 (patch)
treed934c532ec70bea9736e6bab1583c8e0e25ec220
parent7f48519413775ab71c0c13852778430708e3c181 (diff)
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: https://github.com/nodejs/node/issues/27863 Backport-PR-URL: https://github.com/nodejs/node/pull/28904 PR-URL: https://github.com/nodejs/node/pull/27891 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
-rw-r--r--doc/api/http2.md5
-rw-r--r--test/parallel/test-http2-large-write-destroy.js1
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/api/http2.md b/doc/api/http2.md
index 4b7709bc857..897ccb5584c 100644
--- a/doc/api/http2.md
+++ b/doc/api/http2.md
@@ -902,8 +902,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.
-* The `http2stream.close()` method is called.
+* 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.
* 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/test/parallel/test-http2-large-write-destroy.js b/test/parallel/test-http2-large-write-destroy.js
index 24c0a055cc9..b59c66bb047 100644
--- a/test/parallel/test-http2-large-write-destroy.js
+++ b/test/parallel/test-http2-large-write-destroy.js
@@ -32,6 +32,7 @@ server.listen(0, common.mustCall(() => {
const req = client.request({ ':path': '/' });
req.end();
+ req.resume(); // Otherwise close won't be emitted if there's pending data.
req.on('close', common.mustCall(() => {
client.close();