@@ -15,11 +15,6 @@ port = port.port;
1515
1616server . listen ( 128 ) ; 
1717
18- let  sliceCount  =  0 ,  eofCount  =  0 ; 
19- 
20- let  writeCount  =  0 ; 
21- let  recvCount  =  0 ; 
22- 
2318server . onconnection  =  ( err ,  client )  =>  { 
2419  assert . strictEqual ( 0 ,  client . writeQueueSize ) ; 
2520  console . log ( 'got connection' ) ; 
@@ -33,7 +28,7 @@ server.onconnection = (err, client) => {
3328
3429  client . readStart ( ) ; 
3530  client . pendingWrites  =  [ ] ; 
36-   client . onread  =  ( err ,  buffer )  =>  { 
31+   client . onread  =  common . mustCall ( ( err ,  buffer )  =>  { 
3732    if  ( buffer )  { 
3833      assert . ok ( buffer . length  >  0 ) ; 
3934
@@ -50,7 +45,7 @@ server.onconnection = (err, client) => {
5045      assert . strictEqual ( 0 ,  client . writeQueueSize ) ; 
5146
5247      if  ( req . async ) 
53-         req . oncomplete  =  done ; 
48+         req . oncomplete  =  common . mustCall ( done ) ; 
5449      else 
5550        process . nextTick ( done . bind ( null ,  0 ,  client ,  req ) ) ; 
5651
@@ -65,20 +60,16 @@ server.onconnection = (err, client) => {
6560        console . log ( 'client.writeQueueSize: '  +  client . writeQueueSize ) ; 
6661        assert . strictEqual ( 0 ,  client . writeQueueSize ) ; 
6762
68-         writeCount ++ ; 
69-         console . log ( 'write '  +  writeCount ) ; 
7063        maybeCloseClient ( ) ; 
7164      } 
7265
73-       sliceCount ++ ; 
7466    }  else  { 
7567      console . log ( 'eof' ) ; 
7668      client . gotEOF  =  true ; 
7769      server . close ( ) ; 
78-       eofCount ++ ; 
7970      maybeCloseClient ( ) ; 
8071    } 
81-   } ; 
72+   } ,   2 ) ; 
8273} ; 
8374
8475const  net  =  require ( 'net' ) ; 
@@ -88,18 +79,10 @@ const c = net.createConnection(port);
8879c . on ( 'connect' ,  common . mustCall ( ( )  =>  {  c . end ( 'hello world' ) ;  } ) ) ; 
8980
9081c . setEncoding ( 'utf8' ) ; 
91- c . on ( 'data' ,  ( d )  =>  { 
82+ c . on ( 'data' ,  common . mustCall ( ( d )  =>  { 
9283  assert . strictEqual ( 'hello world' ,  d ) ; 
93-   recvCount ++ ; 
94- } ) ; 
84+ } ) ) ; 
9585
9686c . on ( 'close' ,  ( )  =>  { 
9787  console . error ( 'client closed' ) ; 
9888} ) ; 
99- 
100- process . on ( 'exit' ,  ( )  =>  { 
101-   assert . strictEqual ( 1 ,  sliceCount ) ; 
102-   assert . strictEqual ( 1 ,  eofCount ) ; 
103-   assert . strictEqual ( 1 ,  writeCount ) ; 
104-   assert . strictEqual ( 1 ,  recvCount ) ; 
105- } ) ; 
0 commit comments