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 23
23
require ( '../common' ) ;
24
24
const assert = require ( 'assert' ) ;
25
25
const http = require ( 'http' ) ;
26
+ const Countdown = require ( '../common/countdown' ) ;
26
27
const N = 100 ;
27
- let responses = 0 ;
28
28
29
29
const server = http . createServer ( function ( req , res ) {
30
30
res . end ( 'Hello' ) ;
31
31
} ) ;
32
32
33
+ const countdown = new Countdown ( N , ( ) => server . close ( ) ) ;
34
+
33
35
server . listen ( 0 , function ( ) {
34
36
http . globalAgent . maxSockets = 1 ;
35
37
let parser ;
@@ -42,15 +44,9 @@ server.listen(0, function() {
42
44
assert . strictEqual ( req . parser , parser ) ;
43
45
}
44
46
45
- if ( ++ responses === N ) {
46
- server . close ( ) ;
47
- }
47
+ countdown . dec ( ) ;
48
48
res . resume ( ) ;
49
49
} ) ;
50
50
} ) ( i ) ;
51
51
}
52
52
} ) ;
53
-
54
- process . on ( 'exit' , function ( ) {
55
- assert . strictEqual ( responses , N ) ;
56
- } ) ;
You can’t perform that action at this time.
0 commit comments