Skip to content

Commit

Permalink
http2: use the latest settings
Browse files Browse the repository at this point in the history
Fixes: #29764

PR-URL: #29780
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
ZYSzys authored and BethGriggs committed Dec 4, 2019
1 parent fabbc76 commit 8e0ea6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ function onSettings() {
return;
session[kUpdateTimer]();
debugSessionObj(session, 'new settings received');
session[kRemoteSettings] = undefined;
session.emit('remoteSettings', session.remoteSettings);
}

Expand Down
15 changes: 14 additions & 1 deletion test/parallel/test-http2-session-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ server.on(
})
);

server.on('session', (session) => {
session.settings({
maxConcurrentStreams: 2
});
});

server.listen(
0,
common.mustCall(() => {
Expand All @@ -57,11 +63,18 @@ server.listen(
assert.strictEqual(settings.maxFrameSize, 16384);
}, 2)
);

let calledOnce = false;
client.on(
'remoteSettings',
common.mustCall((settings) => {
assert(settings);
})
assert.strictEqual(
settings.maxConcurrentStreams,
calledOnce ? 2 : (2 ** 32) - 1
);
calledOnce = true;
}, 2)
);

const headers = { ':path': '/' };
Expand Down

0 comments on commit 8e0ea6d

Please sign in to comment.