@@ -61,7 +61,7 @@ function Agent(options) {
6161 this . maxFreeSockets = this . options . maxFreeSockets || 256 ;
6262
6363 this . on ( 'free' , ( socket , options ) => {
64- var name = this . getName ( options ) ;
64+ const name = this . getName ( options ) ;
6565 debug ( 'agent.on(free)' , name ) ;
6666
6767 if ( socket . writable &&
@@ -153,13 +153,13 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
153153 if ( ! options . servername )
154154 options . servername = calculateServerName ( options , req ) ;
155155
156- var name = this . getName ( options ) ;
156+ const name = this . getName ( options ) ;
157157 if ( ! this . sockets [ name ] ) {
158158 this . sockets [ name ] = [ ] ;
159159 }
160160
161- var freeLen = this . freeSockets [ name ] ? this . freeSockets [ name ] . length : 0 ;
162- var sockLen = freeLen + this . sockets [ name ] . length ;
161+ const freeLen = this . freeSockets [ name ] ? this . freeSockets [ name ] . length : 0 ;
162+ const sockLen = freeLen + this . sockets [ name ] . length ;
163163
164164 if ( freeLen ) {
165165 // We have a free socket, so use that.
@@ -200,7 +200,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
200200 if ( ! options . servername )
201201 options . servername = calculateServerName ( options , req ) ;
202202
203- var name = this . getName ( options ) ;
203+ const name = this . getName ( options ) ;
204204 options . _agentKey = name ;
205205
206206 debug ( 'createConnection' , name , options ) ;
@@ -280,9 +280,9 @@ function installListeners(agent, s, options) {
280280}
281281
282282Agent . prototype . removeSocket = function removeSocket ( s , options ) {
283- var name = this . getName ( options ) ;
283+ const name = this . getName ( options ) ;
284284 debug ( 'removeSocket' , name , 'writable:' , s . writable ) ;
285- var sets = [ this . sockets ] ;
285+ const sets = [ this . sockets ] ;
286286
287287 // If the socket was destroyed, remove it from the free buffers too.
288288 if ( ! s . writable )
@@ -324,7 +324,7 @@ Agent.prototype.reuseSocket = function reuseSocket(socket, req) {
324324} ;
325325
326326Agent . prototype . destroy = function destroy ( ) {
327- var sets = [ this . freeSockets , this . sockets ] ;
327+ const sets = [ this . freeSockets , this . sockets ] ;
328328 for ( var s = 0 ; s < sets . length ; s ++ ) {
329329 var set = sets [ s ] ;
330330 var keys = Object . keys ( set ) ;
0 commit comments