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 <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
ZYSzys authored and MylesBorins committed Dec 17, 2019
1 parent 7e941eb commit 20f64a9
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
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
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 20f64a9

Please sign in to comment.