Skip to content

Commit c0a2e02

Browse files
jasnellItalo A. Casas
authored andcommitted
net: avoid using forEach
PR-URL: #11582 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent a0b1aa1 commit c0a2e02

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

‎lib/net.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,9 +1502,9 @@ Server.prototype.getConnections = function(cb){
15021502
if(--left===0)returnend(null,total);
15031503
}
15041504

1505-
this._slaves.forEach(function(slave){
1506-
slave.getConnections(oncount);
1507-
});
1505+
for(varn=0;n<this._slaves.length;n++){
1506+
this._slaves[n].getConnections(oncount);
1507+
}
15081508
};
15091509

15101510

@@ -1540,9 +1540,8 @@ Server.prototype.close = function(cb){
15401540
this._connections++;
15411541

15421542
// Poll slaves
1543-
this._slaves.forEach(function(slave){
1544-
slave.close(onSlaveClose);
1545-
});
1543+
for(varn=0;n<this._slaves.length;n++)
1544+
this._slaves[n].close(onSlaveClose);
15461545
}else{
15471546
this._emitCloseIfDrained();
15481547
}

0 commit comments

Comments
(0)