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: add a number of checks for server close callback #18182

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
3 changes: 2 additions & 1 deletion test/parallel/test-http2-create-client-secure-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function onStream(stream, headers) {
function verifySecureSession(key, cert, ca, opts) {
const server = h2.createSecureServer({ cert, key });
server.on('stream', common.mustCall(onStream));
server.on('close', common.mustCall());
server.listen(0, common.mustCall(() => {
opts = opts || { };
opts.secureContext = tls.createSecureContext({ ca });
Expand Down Expand Up @@ -72,7 +73,7 @@ function verifySecureSession(key, cert, ca, opts) {
assert.strictEqual(jsonData.servername,
opts.servername || 'localhost');
assert.strictEqual(jsonData.alpnProtocol, 'h2');
server.close();
server.close(common.mustCall());
client[kSocket].destroy();
}));
}));
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-http2-create-client-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function onStream(stream, headers, flags) {
stream.end(body.slice(20));
}

server.on('close', common.mustCall());

server.listen(0);

server.on('listening', common.mustCall(() => {
Expand All @@ -46,7 +48,7 @@ server.on('listening', common.mustCall(() => {

const countdown = new Countdown(count, () => {
client.close();
server.close();
server.close(common.mustCall());
});

for (let n = 0; n < count; n++) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http2-createwritereq.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ server.listen(0, common.mustCall(function() {
testsFinished++;

if (testsFinished === testsToRun) {
server.close();
server.close(common.mustCall());
}
}));

Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-http2-misbehaving-flow-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ server.on('stream', (stream) => {
message: 'Stream closed with error code 3'
}));
stream.on('close', common.mustCall(() => {
server.close();
server.close(common.mustCall());
client.destroy();
}));
stream.resume();
stream.respond();
stream.end('ok');
});

server.on('close', common.mustCall());

server.listen(0, () => {
client = net.connect(server.address().port, () => {
client.write(preamble);
Expand Down