@@ -60,7 +60,7 @@ function Agent(options) {
6060 this . maxFreeSockets = this . options . maxFreeSockets || 256 ;
6161
6262 this . on ( 'free' , ( socket , options ) => {
63- var name = this . getName ( options ) ;
63+ const name = this . getName ( options ) ;
6464 debug ( 'agent.on(free)' , name ) ;
6565
6666 if ( socket . writable &&
@@ -152,13 +152,13 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
152152 if ( ! options . servername )
153153 options . servername = calculateServerName ( options , req ) ;
154154
155- var name = this . getName ( options ) ;
155+ const name = this . getName ( options ) ;
156156 if ( ! this . sockets [ name ] ) {
157157 this . sockets [ name ] = [ ] ;
158158 }
159159
160- var freeLen = this . freeSockets [ name ] ? this . freeSockets [ name ] . length : 0 ;
161- var sockLen = freeLen + this . sockets [ name ] . length ;
160+ const freeLen = this . freeSockets [ name ] ? this . freeSockets [ name ] . length : 0 ;
161+ const sockLen = freeLen + this . sockets [ name ] . length ;
162162
163163 if ( freeLen ) {
164164 // We have a free socket, so use that.
@@ -199,7 +199,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
199199 if ( ! options . servername )
200200 options . servername = calculateServerName ( options , req ) ;
201201
202- var name = this . getName ( options ) ;
202+ const name = this . getName ( options ) ;
203203 options . _agentKey = name ;
204204
205205 debug ( 'createConnection' , name , options ) ;
@@ -279,9 +279,9 @@ function installListeners(agent, s, options) {
279279}
280280
281281Agent . prototype . removeSocket = function removeSocket ( s , options ) {
282- var name = this . getName ( options ) ;
282+ const name = this . getName ( options ) ;
283283 debug ( 'removeSocket' , name , 'writable:' , s . writable ) ;
284- var sets = [ this . sockets ] ;
284+ const sets = [ this . sockets ] ;
285285
286286 // If the socket was destroyed, remove it from the free buffers too.
287287 if ( ! s . writable )
@@ -323,7 +323,7 @@ Agent.prototype.reuseSocket = function reuseSocket(socket, req) {
323323} ;
324324
325325Agent . prototype . destroy = function destroy ( ) {
326- var sets = [ this . freeSockets , this . sockets ] ;
326+ const sets = [ this . freeSockets , this . sockets ] ;
327327 for ( var s = 0 ; s < sets . length ; s ++ ) {
328328 var set = sets [ s ] ;
329329 var keys = Object . keys ( set ) ;
0 commit comments