@@ -32,7 +32,7 @@ const http = require('http');
32
32
const url = require ( 'url' ) ;
33
33
34
34
const body = 'hello world\n' ;
35
- const server = http . createServer ( function ( req , res ) {
35
+ const server = http . createServer ( ( req , res ) => {
36
36
res . writeHead ( 200 , {
37
37
'Content-Length' : body . length ,
38
38
'Content-Type' : 'text/plain'
@@ -45,7 +45,7 @@ let keepAliveReqSec = 0;
45
45
let normalReqSec = 0 ;
46
46
47
47
48
- function runAb ( opts , callback ) {
48
+ const runAb = ( opts , callback ) => {
49
49
const args = [
50
50
'-c' , opts . concurrent || 100 ,
51
51
'-t' , opts . threads || 2 ,
@@ -66,11 +66,9 @@ function runAb(opts, callback) {
66
66
67
67
let stdout ;
68
68
69
- child . stdout . on ( 'data' , function ( data ) {
70
- stdout += data ;
71
- } ) ;
69
+ child . stdout . on ( 'data' , ( data ) => stdout += data ) ;
72
70
73
- child . on ( 'close' , function ( code , signal ) {
71
+ child . on ( 'close' , ( code , signal ) => {
74
72
if ( code ) {
75
73
console . error ( code , signal ) ;
76
74
process . exit ( code ) ;
@@ -90,20 +88,20 @@ function runAb(opts, callback) {
90
88
91
89
callback ( reqSec , keepAliveRequests ) ;
92
90
} ) ;
93
- }
91
+ } ;
94
92
95
93
server . listen ( common . PORT , ( ) => {
96
94
runAb ( { keepalive : true } , ( reqSec ) => {
97
95
keepAliveReqSec = reqSec ;
98
96
99
- runAb ( { keepalive : false } , function ( reqSec ) {
97
+ runAb ( { keepalive : false } , ( reqSec ) => {
100
98
normalReqSec = reqSec ;
101
99
server . close ( ) ;
102
100
} ) ;
103
101
} ) ;
104
102
} ) ;
105
103
106
- process . on ( 'exit' , function ( ) {
104
+ process . on ( 'exit' , ( ) => {
107
105
assert . strictEqual (
108
106
normalReqSec > 50 ,
109
107
true ,
0 commit comments