@@ -44,7 +44,7 @@ if (cluster.isMaster) {
4444 const c = tls . connect ( workerPort , {
4545 session : lastSession ,
4646 rejectUnauthorized : false
47- } , function ( ) {
47+ } , ( ) => {
4848 lastSession = c . getSession ( ) ;
4949 c . end ( ) ;
5050
@@ -60,7 +60,7 @@ if (cluster.isMaster) {
6060
6161 function fork ( ) {
6262 const worker = cluster . fork ( ) ;
63- worker . on ( 'message' , function ( { msg, port } ) {
63+ worker . on ( 'message' , ( { msg, port } ) => {
6464 console . error ( '[master] got %j' , msg ) ;
6565 if ( msg === 'reused' ) {
6666 ++ reusedCount ;
@@ -71,15 +71,15 @@ if (cluster.isMaster) {
7171 }
7272 } ) ;
7373
74- worker . on ( 'exit' , function ( ) {
74+ worker . on ( 'exit' , ( ) => {
7575 console . error ( '[master] worker died' ) ;
7676 } ) ;
7777 }
7878 for ( let i = 0 ; i < workerCount ; i ++ ) {
7979 fork ( ) ;
8080 }
8181
82- process . on ( 'exit' , function ( ) {
82+ process . on ( 'exit' , ( ) => {
8383 assert . strictEqual ( reqCount , expectedReqCount ) ;
8484 assert . strictEqual ( reusedCount + 1 , reqCount ) ;
8585 } ) ;
@@ -91,7 +91,7 @@ const cert = fixtures.readSync('agent.crt');
9191
9292const options = { key, cert } ;
9393
94- const server = tls . createServer ( options , function ( c ) {
94+ const server = tls . createServer ( options , ( c ) => {
9595 if ( c . isSessionReused ( ) ) {
9696 process . send ( { msg : 'reused' } ) ;
9797 } else {
@@ -100,7 +100,7 @@ const server = tls.createServer(options, function(c) {
100100 c . end ( ) ;
101101} ) ;
102102
103- server . listen ( 0 , function ( ) {
103+ server . listen ( 0 , ( ) => {
104104 const { port } = server . address ( ) ;
105105 process . send ( {
106106 msg : 'listening' ,
@@ -111,14 +111,14 @@ server.listen(0, function() {
111111process . on ( 'message' , function listener ( msg ) {
112112 console . error ( '[worker] got %j' , msg ) ;
113113 if ( msg === 'die' ) {
114- server . close ( function ( ) {
114+ server . close ( ( ) => {
115115 console . error ( '[worker] server close' ) ;
116116
117117 process . exit ( ) ;
118118 } ) ;
119119 }
120120} ) ;
121121
122- process . on ( 'exit' , function ( ) {
122+ process . on ( 'exit' , ( ) => {
123123 console . error ( '[worker] exit' ) ;
124124} ) ;
0 commit comments