File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 2
2
require ( '../common' ) ;
3
3
const assert = require ( 'assert' ) ;
4
4
const http = require ( 'http' ) ;
5
+ const Countdown = require ( '../common/countdown' ) ;
5
6
const N = 100 ;
6
- let responses = 0 ;
7
7
8
8
const server = http . createServer ( function ( req , res ) {
9
9
res . end ( 'Hello' ) ;
10
10
} ) ;
11
11
12
+ const countdown = new Countdown ( N , ( ) => server . close ( ) ) ;
13
+
12
14
server . listen ( 0 , function ( ) {
13
15
http . globalAgent . maxSockets = 1 ;
14
16
let parser ;
@@ -21,15 +23,9 @@ server.listen(0, function() {
21
23
assert . strictEqual ( req . parser , parser ) ;
22
24
}
23
25
24
- if ( ++ responses === N ) {
25
- server . close ( ) ;
26
- }
26
+ countdown . dec ( ) ;
27
27
res . resume ( ) ;
28
28
} ) ;
29
29
} ) ( i ) ;
30
30
}
31
31
} ) ;
32
-
33
- process . on ( 'exit' , function ( ) {
34
- assert . strictEqual ( responses , N ) ;
35
- } ) ;
You can’t perform that action at this time.
0 commit comments