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 22require ( '../common' ) ;
33const assert = require ( 'assert' ) ;
44const http = require ( 'http' ) ;
5+ const Countdown = require ( '../common/countdown' ) ;
56const N = 100 ;
6- let responses = 0 ;
77
88const server = http . createServer ( function ( req , res ) {
99 res . end ( 'Hello' ) ;
1010} ) ;
1111
12+ const countdown = new Countdown ( N , ( ) => server . close ( ) ) ;
13+
1214server . listen ( 0 , function ( ) {
1315 http . globalAgent . maxSockets = 1 ;
1416 let parser ;
@@ -21,15 +23,9 @@ server.listen(0, function() {
2123 assert . strictEqual ( req . parser , parser ) ;
2224 }
2325
24- if ( ++ responses === N ) {
25- server . close ( ) ;
26- }
26+ countdown . dec ( ) ;
2727 res . resume ( ) ;
2828 } ) ;
2929 } ) ( i ) ;
3030 }
3131} ) ;
32-
33- process . on ( 'exit' , function ( ) {
34- assert . strictEqual ( responses , N ) ;
35- } ) ;
You can’t perform that action at this time.
0 commit comments