@@ -32,7 +32,7 @@ const http = require('http');
3232const url = require ( 'url' ) ;
3333
3434const body = 'hello world\n' ;
35- const server = http . createServer ( function ( req , res ) {
35+ const server = http . createServer ( ( req , res ) => {
3636 res . writeHead ( 200 , {
3737 'Content-Length' : body . length ,
3838 'Content-Type' : 'text/plain'
@@ -45,7 +45,7 @@ let keepAliveReqSec = 0;
4545let normalReqSec = 0 ;
4646
4747
48- function runAb ( opts , callback ) {
48+ const runAb = ( opts , callback ) => {
4949 const args = [
5050 '-c' , opts . concurrent || 100 ,
5151 '-t' , opts . threads || 2 ,
@@ -66,11 +66,9 @@ function runAb(opts, callback) {
6666
6767 let stdout ;
6868
69- child . stdout . on ( 'data' , function ( data ) {
70- stdout += data ;
71- } ) ;
69+ child . stdout . on ( 'data' , ( data ) => stdout += data ) ;
7270
73- child . on ( 'close' , function ( code , signal ) {
71+ child . on ( 'close' , ( code , signal ) => {
7472 if ( code ) {
7573 console . error ( code , signal ) ;
7674 process . exit ( code ) ;
@@ -90,20 +88,20 @@ function runAb(opts, callback) {
9088
9189 callback ( reqSec , keepAliveRequests ) ;
9290 } ) ;
93- }
91+ } ;
9492
9593server . listen ( common . PORT , ( ) => {
9694 runAb ( { keepalive : true } , ( reqSec ) => {
9795 keepAliveReqSec = reqSec ;
9896
99- runAb ( { keepalive : false } , function ( reqSec ) {
97+ runAb ( { keepalive : false } , ( reqSec ) => {
10098 normalReqSec = reqSec ;
10199 server . close ( ) ;
102100 } ) ;
103101 } ) ;
104102} ) ;
105103
106- process . on ( 'exit' , function ( ) {
104+ process . on ( 'exit' , ( ) => {
107105 assert . strictEqual (
108106 normalReqSec > 50 ,
109107 true ,
0 commit comments