diff options
author | Momtchil Momtchev <momtchil@momtchev.com> | 2020-10-18 15:52:54 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-10-25 13:29:46 +0300 |
commit | 1f703e120403d41d4f274ad9d30a9512788e5edc (patch) | |
tree | 62885cdcaaa5c7f1386ca28920fa5cb8aa8d027f | |
parent | 75202d971d3a18824f357bbb31671291a1dc4e84 (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.js | 2 |
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`); |