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

test: adding Countdown to test-http-incoming-pipelined-socket-destroy.js #17506

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions test/parallel/test-http-incoming-pipelined-socket-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

'use strict';
const common = require('../common');
const Countdown = require('../common/countdown');

const http = require('http');
const net = require('net');

Copy link
Member

Choose a reason for hiding this comment

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

Hi @idandagan1 — one little change before this lands, could you re-insert this line break between the requires and the rest of the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

const seeds = [ 3, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 ];
const countdown = new Countdown(seeds.length, () => server.close());

// Set up some timing issues where sockets can be destroyed
// via either the req or res.
Expand Down Expand Up @@ -72,11 +73,8 @@ function generator(seeds) {

server.listen(0, common.mustCall(function() {
const client = net.connect({ port: this.address().port });
let done = 0;
server.on('requestDone', function() {
if (++done === seeds.length) {
server.close();
}
countdown.dec();
});

// immediately write the pipelined requests.
Expand Down