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:
authorMomtchil Momtchev <momtchil@momtchev.com>2020-10-18 15:52:54 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2020-10-25 13:29:46 +0300
commit1f703e120403d41d4f274ad9d30a9512788e5edc (patch)
tree62885cdcaaa5c7f1386ca28920fa5cb8aa8d027f
parent75202d971d3a18824f357bbb31671291a1dc4e84 (diff)
http2: fix reinjection check
We reinject when the sockets has already waiting data, remarked by @mildsunrise Co-authored-by: Alba Mendez <me@alba.sh> PR-URL: https://github.com/nodejs/node/pull/35678 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Alba Mendez <me@alba.sh> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
-rw-r--r--lib/internal/http2/core.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index a938d543ed8..7ae3a7565d9 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -3144,7 +3144,7 @@ function connect(authority, options, listener) {
debug('Http2Session connect', options.createConnection);
// Socket already has some buffered data - emulate receiving it
// https://github.com/nodejs/node/issues/35475
- if (typeof options.createConnection === 'function') {
+ if (socket && socket.readableLength) {
let buf;
while ((buf = socket.read()) !== null) {
debug(`Http2Session connect: injecting ${buf.length} already in buffer`);