Skip to content

Commit f0994c6

Browse files
palmirestargos
authored andcommitted
http: replace vars with lets and consts in lib/_http_agent.js
PR-URL: #30301 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent a3369b2 commit f0994c6

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

‎lib/_http_agent.js‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ function Agent(options) {
9191
}else{
9292
// If there are no pending requests, then put it in
9393
// the freeSockets pool, but only if we're allowed to do so.
94-
varreq=socket._httpMessage;
94+
constreq=socket._httpMessage;
9595
if(req&&
9696
req.shouldKeepAlive&&
9797
socket.writable&&
9898
this.keepAlive){
99-
varfreeSockets=this.freeSockets[name];
100-
varfreeLen=freeSockets ? freeSockets.length : 0;
101-
varcount=freeLen;
99+
letfreeSockets=this.freeSockets[name];
100+
constfreeLen=freeSockets ? freeSockets.length : 0;
101+
letcount=freeLen;
102102
if(this.sockets[name])
103103
count+=this.sockets[name].length;
104104

@@ -130,7 +130,7 @@ Agent.prototype.createConnection = net.createConnection;
130130

131131
// Get the key for a given set of request options
132132
Agent.prototype.getName=functiongetName(options){
133-
varname=options.host||'localhost';
133+
letname=options.host||'localhost';
134134

135135
name+=':';
136136
if(options.port)
@@ -179,7 +179,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
179179

180180
if(freeLen){
181181
// We have a free socket, so use that.
182-
varsocket=this.freeSockets[name].shift();
182+
constsocket=this.freeSockets[name].shift();
183183
// Guard against an uninitialized or user supplied Socket.
184184
consthandle=socket._handle;
185185
if(handle&&typeofhandle.asyncReset==='function'){
@@ -222,7 +222,7 @@ Agent.prototype.createSocket = function createSocket(req, options, cb) {
222222

223223
debug('createConnection',name,options);
224224
options.encoding=null;
225-
varcalled=false;
225+
letcalled=false;
226226

227227
constoncreate=(err,s)=>{
228228
if(called)
@@ -308,11 +308,11 @@ Agent.prototype.removeSocket = function removeSocket(s, options) {
308308
if(!s.writable)
309309
sets.push(this.freeSockets);
310310

311-
for(varsk=0;sk<sets.length;sk++){
312-
varsockets=sets[sk];
311+
for(letsk=0;sk<sets.length;sk++){
312+
constsockets=sets[sk];
313313

314314
if(sockets[name]){
315-
varindex=sockets[name].indexOf(s);
315+
constindex=sockets[name].indexOf(s);
316316
if(index!==-1){
317317
sockets[name].splice(index,1);
318318
// Don't leak
@@ -345,12 +345,12 @@ Agent.prototype.reuseSocket = function reuseSocket(socket, req) {
345345

346346
Agent.prototype.destroy=functiondestroy(){
347347
constsets=[this.freeSockets,this.sockets];
348-
for(vars=0;s<sets.length;s++){
349-
varset=sets[s];
350-
varkeys=Object.keys(set);
351-
for(varv=0;v<keys.length;v++){
352-
varsetName=set[keys[v]];
353-
for(varn=0;n<setName.length;n++){
348+
for(lets=0;s<sets.length;s++){
349+
constset=sets[s];
350+
constkeys=Object.keys(set);
351+
for(letv=0;v<keys.length;v++){
352+
constsetName=set[keys[v]];
353+
for(letn=0;n<setName.length;n++){
354354
setName[n].destroy();
355355
}
356356
}

0 commit comments

Comments
 (0)