Skip to content
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
Next Next commit
test: Update test-http-parser-free to use countdown timer
Fixes: #17169
  • Loading branch information
daxlab committed Nov 26, 2017
commit ad7608f8e9b579dfe00cd24acb1d3483d9100fb7
9 changes: 5 additions & 4 deletions test/parallel/test-http-parser-free.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@
require('../common');
const assert = require('assert');
const http = require('http');
const Countdown = require('../common/countdown');
const N = 100;
let responses = 0;
const responses = 0;

const server = http.createServer(function(req, res) {
res.end('Hello');
});

const countdown = new Countdown(N, () => server.close());

server.listen(0, function() {
http.globalAgent.maxSockets = 1;
let parser;
Expand All @@ -42,9 +45,7 @@ server.listen(0, function() {
assert.strictEqual(req.parser, parser);
}

if (++responses === N) {
server.close();
}
countdown.dec();
res.resume();
});
})(i);
Expand Down