@@ -61,7 +61,7 @@ function Agent(options) {
61
61
this . maxFreeSockets = this . options . maxFreeSockets || 256 ;
62
62
63
63
this . on ( 'free' , ( socket , options ) => {
64
- var name = this . getName ( options ) ;
64
+ const name = this . getName ( options ) ;
65
65
debug ( 'agent.on(free)' , name ) ;
66
66
67
67
if ( socket . writable &&
@@ -153,13 +153,13 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
153
153
if ( ! options . servername )
154
154
options . servername = calculateServerName ( options , req ) ;
155
155
156
- var name = this . getName ( options ) ;
156
+ const name = this . getName ( options ) ;
157
157
if ( ! this . sockets [ name ] ) {
158
158
this . sockets [ name ] = [ ] ;
159
159
}
160
160
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 ;
163
163
164
164
if ( freeLen ) {
165
165
// We have a free socket, so use that.
@@ -200,7 +200,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
200
200
if ( ! options . servername )
201
201
options . servername = calculateServerName ( options , req ) ;
202
202
203
- var name = this . getName ( options ) ;
203
+ const name = this . getName ( options ) ;
204
204
options . _agentKey = name ;
205
205
206
206
debug ( 'createConnection' , name , options ) ;
@@ -280,9 +280,9 @@ function installListeners(agent, s, options) {
280
280
}
281
281
282
282
Agent . prototype . removeSocket = function removeSocket ( s , options ) {
283
- var name = this . getName ( options ) ;
283
+ const name = this . getName ( options ) ;
284
284
debug ( 'removeSocket' , name , 'writable:' , s . writable ) ;
285
- var sets = [ this . sockets ] ;
285
+ const sets = [ this . sockets ] ;
286
286
287
287
// If the socket was destroyed, remove it from the free buffers too.
288
288
if ( ! s . writable )
@@ -324,7 +324,7 @@ Agent.prototype.reuseSocket = function reuseSocket(socket, req) {
324
324
} ;
325
325
326
326
Agent . prototype . destroy = function destroy ( ) {
327
- var sets = [ this . freeSockets , this . sockets ] ;
327
+ const sets = [ this . freeSockets , this . sockets ] ;
328
328
for ( var s = 0 ; s < sets . length ; s ++ ) {
329
329
var set = sets [ s ] ;
330
330
var keys = Object . keys ( set ) ;
0 commit comments