Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: use the latest settings #29780

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ function onSettings() {
return;
session[kUpdateTimer]();
debugSessionObj(session, 'new settings received');
session[kRemoteSettings] = undefined;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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