Skip to content

Commit

Permalink
http2: fix reinjection check
Browse files Browse the repository at this point in the history
We reinject when the sockets has already waiting
data, remarked by @mildsunrise

Co-authored-by: Alba Mendez <me@alba.sh>

PR-URL: #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>
  • Loading branch information
mmomtchev authored and BethGriggs committed Dec 15, 2020
1 parent 57f2fe0 commit ec9fae9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3110,7 +3110,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`);
Expand Down

0 comments on commit ec9fae9

Please sign in to comment.