diff options
author | James M Snell <jasnell@gmail.com> | 2017-02-26 18:08:04 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-17 11:09:30 -0700 |
commit | 42e55eb37bb65541562ae6f6e2b636b6c4efb301 (patch) | |
tree | 827acdeb1abbaa69b9cd11c6e54680ac6b90b3f9 /lib | |
parent | 4d090855c6199cb1308ed88afbdfbf691533c758 (diff) | |
download | android-node-v8-42e55eb37bb65541562ae6f6e2b636b6c4efb301.tar.gz android-node-v8-42e55eb37bb65541562ae6f6e2b636b6c4efb301.tar.bz2 android-node-v8-42e55eb37bb65541562ae6f6e2b636b6c4efb301.zip |
net: avoid using forEach
PR-URL: https://github.com/nodejs/node/pull/11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/net.js b/lib/net.js index fb9c72cb95..7690254042 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1524,9 +1524,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); + } }; @@ -1562,9 +1562,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(); } |