Skip to content

Commit

Permalink
http2: use the latest settings
Browse files Browse the repository at this point in the history
Fixes: #29764
  • Loading branch information
ZYSzys committed Oct 1, 2019
1 parent 16e47b9 commit 420c07a
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 @@ -510,6 +510,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 420c07a

Please sign in to comment.