@@ -44,7 +44,7 @@ if (cluster.isMaster) {
44
44
const c = tls . connect ( workerPort , {
45
45
session : lastSession ,
46
46
rejectUnauthorized : false
47
- } , function ( ) {
47
+ } , ( ) => {
48
48
lastSession = c . getSession ( ) ;
49
49
c . end ( ) ;
50
50
@@ -60,7 +60,7 @@ if (cluster.isMaster) {
60
60
61
61
function fork ( ) {
62
62
const worker = cluster . fork ( ) ;
63
- worker . on ( 'message' , function ( { msg, port } ) {
63
+ worker . on ( 'message' , ( { msg, port } ) => {
64
64
console . error ( '[master] got %j' , msg ) ;
65
65
if ( msg === 'reused' ) {
66
66
++ reusedCount ;
@@ -71,15 +71,15 @@ if (cluster.isMaster) {
71
71
}
72
72
} ) ;
73
73
74
- worker . on ( 'exit' , function ( ) {
74
+ worker . on ( 'exit' , ( ) => {
75
75
console . error ( '[master] worker died' ) ;
76
76
} ) ;
77
77
}
78
78
for ( let i = 0 ; i < workerCount ; i ++ ) {
79
79
fork ( ) ;
80
80
}
81
81
82
- process . on ( 'exit' , function ( ) {
82
+ process . on ( 'exit' , ( ) => {
83
83
assert . strictEqual ( reqCount , expectedReqCount ) ;
84
84
assert . strictEqual ( reusedCount + 1 , reqCount ) ;
85
85
} ) ;
@@ -91,7 +91,7 @@ const cert = fixtures.readSync('agent.crt');
91
91
92
92
const options = { key, cert } ;
93
93
94
- const server = tls . createServer ( options , function ( c ) {
94
+ const server = tls . createServer ( options , ( c ) => {
95
95
if ( c . isSessionReused ( ) ) {
96
96
process . send ( { msg : 'reused' } ) ;
97
97
} else {
@@ -100,7 +100,7 @@ const server = tls.createServer(options, function(c) {
100
100
c . end ( ) ;
101
101
} ) ;
102
102
103
- server . listen ( 0 , function ( ) {
103
+ server . listen ( 0 , ( ) => {
104
104
const { port } = server . address ( ) ;
105
105
process . send ( {
106
106
msg : 'listening' ,
@@ -111,14 +111,14 @@ server.listen(0, function() {
111
111
process . on ( 'message' , function listener ( msg ) {
112
112
console . error ( '[worker] got %j' , msg ) ;
113
113
if ( msg === 'die' ) {
114
- server . close ( function ( ) {
114
+ server . close ( ( ) => {
115
115
console . error ( '[worker] server close' ) ;
116
116
117
117
process . exit ( ) ;
118
118
} ) ;
119
119
}
120
120
} ) ;
121
121
122
- process . on ( 'exit' , function ( ) {
122
+ process . on ( 'exit' , ( ) => {
123
123
console . error ( '[worker] exit' ) ;
124
124
} ) ;
0 commit comments