From 62f5f4e33eae357dcd460d45a3c871b310b63297 Mon Sep 17 00:00:00 2001 From: idandagan1 Date: Wed, 6 Dec 2017 21:57:13 +0200 Subject: [PATCH 1/2] adding Countdown to test-http-incoming-pipelined-socket-destroy.js --- .../test-http-incoming-pipelined-socket-destroy.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 7c15339785137b..4dd5d5b2290357 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -21,11 +21,12 @@ '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 +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. From 187e3a02a135a1a7d32324effdc1b9717fd40b45 Mon Sep 17 00:00:00 2001 From: Idan Dagan Date: Fri, 8 Dec 2017 22:51:17 +0200 Subject: [PATCH 2/2] Update test-http-incoming-pipelined-socket-destroy.js --- test/parallel/test-http-incoming-pipelined-socket-destroy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 4dd5d5b2290357..8e63bdb8a9bbd2 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -25,6 +25,7 @@ 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());