File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -9,24 +9,20 @@ const net = require('net');
99// and the last 10 connections are rejected. 
1010
1111const  N  =  20 ; 
12- var  count  =  0 ; 
1312var  closes  =  0 ; 
1413const  waits  =  [ ] ; 
1514
16- const  server  =  net . createServer ( function ( connection )  { 
17-   console . error ( 'connect %d' ,  count ++ ) ; 
15+ const  server  =  net . createServer ( common . mustCall ( function ( connection )  { 
1816  connection . write ( 'hello' ) ; 
1917  waits . push ( function ( )  {  connection . end ( ) ;  } ) ; 
20- } ) ; 
18+ } ,   N   /   2 ) ) ; 
2119
2220server . listen ( 0 ,  function ( )  { 
2321  makeConnection ( 0 ) ; 
2422} ) ; 
2523
2624server . maxConnections  =  N  /  2 ; 
2725
28- console . error ( 'server.maxConnections = %d' ,  server . maxConnections ) ; 
29- 
3026
3127function  makeConnection ( index )  { 
3228  const  c  =  net . createConnection ( server . address ( ) . port ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments