File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const N = 80;
1414
1515if ( process . argv [ 2 ] !== 'child' ) {
1616 for ( let i = 0 ; i < N ; ++ i ) {
17- const worker = fork ( __filename , [ 'child' , common . PORT + i ] ) ;
17+ const worker = fork ( __filename , [ 'child' ] ) ;
1818 worker . once ( 'message' , common . mustCall ( ( msg , handle ) => {
1919 assert . strictEqual ( msg , 'handle' ) ;
2020 assert . ok ( handle ) ;
@@ -33,7 +33,6 @@ if (process.argv[2] !== 'child') {
3333 }
3434} else {
3535 let socket ;
36- const port = process . argv [ 3 ] ;
3736 let cbcalls = 0 ;
3837 function socketConnected ( ) {
3938 if ( ++ cbcalls === 2 )
@@ -47,7 +46,8 @@ if (process.argv[2] !== 'child') {
4746 } ) ;
4847 socketConnected ( ) ;
4948 } ) ;
50- server . listen ( port , common . localhostIPv4 , ( ) => {
49+ server . listen ( 0 , common . localhostIPv4 , ( ) => {
50+ const port = server . address ( ) . port ;
5151 socket = net . connect ( port , common . localhostIPv4 , socketConnected ) ;
5252 } ) ;
5353}
You can’t perform that action at this time.
0 commit comments