summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoridandagan1 <idandagan1@gmail.com>2017-12-06 21:57:13 +0200
committerAnatoli Papirovski <apapirovski@mac.com>2017-12-08 15:57:35 -0500
commit20d6b8c6c01c09a51f503f7f8a0fee494be6f742 (patch)
treecc9e6788d0f6e8ee411bf197c8a9c8c274266385
parent5279035d93fbc17317700c465612118a0a6e41ba (diff)
downloadnode-new-20d6b8c6c01c09a51f503f7f8a0fee494be6f742.tar.gz
test: use Countdown in http test
PR-URL: https://github.com/nodejs/node/pull/17506 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
-rw-r--r--test/parallel/test-http-incoming-pipelined-socket-destroy.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js
index 7c15339785..8e63bdb8a9 100644
--- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js
+++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js
@@ -21,11 +21,13 @@
'use strict';
const common = require('../common');
+const Countdown = require('../common/countdown');
const http = require('http');
const net = require('net');
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.
@@ -72,11 +74,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.