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 2323require ( '../common' ) ;
2424const assert = require ( 'assert' ) ;
2525const http = require ( 'http' ) ;
26+ const Countdown = require ( '../common/countdown' ) ;
2627const N = 100 ;
27- let responses = 0 ;
2828
2929const server = http . createServer ( function ( req , res ) {
3030 res . end ( 'Hello' ) ;
3131} ) ;
3232
33+ const countdown = new Countdown ( N , ( ) => server . close ( ) ) ;
34+
3335server . listen ( 0 , function ( ) {
3436 http . globalAgent . maxSockets = 1 ;
3537 let parser ;
@@ -42,15 +44,9 @@ server.listen(0, function() {
4244 assert . strictEqual ( req . parser , parser ) ;
4345 }
4446
45- if ( ++ responses === N ) {
46- server . close ( ) ;
47- }
47+ countdown . dec ( ) ;
4848 res . resume ( ) ;
4949 } ) ;
5050 } ) ( i ) ;
5151 }
5252} ) ;
53-
54- process . on ( 'exit' , function ( ) {
55- assert . strictEqual ( responses , N ) ;
56- } ) ;
You can’t perform that action at this time.
0 commit comments