Skip to content

Commit

Permalink
net: avoid using forEach
Browse files Browse the repository at this point in the history
PR-URL: #11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
jasnell authored and italoacasas committed Mar 20, 2017
1 parent a0b1aa1 commit c0a2e02
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -1502,9 +1502,9 @@ Server.prototype.getConnections = function(cb) {
if (--left === 0) return end(null, total);
}

this._slaves.forEach(function(slave) {
slave.getConnections(oncount);
});
for (var n = 0; n < this._slaves.length; n++) {
this._slaves[n].getConnections(oncount);
}
};


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

// Poll slaves
this._slaves.forEach(function(slave) {
slave.close(onSlaveClose);
});
for (var n = 0; n < this._slaves.length; n++)
this._slaves[n].close(onSlaveClose);
} else {
this._emitCloseIfDrained();
}
Expand Down

0 comments on commit c0a2e02

Please sign in to comment.