From 396cfbad7fb8a87bb8ef08d7c27ffc26232e661e Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Wed, 21 Oct 2015 16:58:41 +0900 Subject: [PATCH] Allocated ports were not being released properly due to fork() now consuming the ports. Additionally fixes port pool grouping. Fixes #138. --- lib/units/provider/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/units/provider/index.js b/lib/units/provider/index.js index 77e0c14a..0109738c 100644 --- a/lib/units/provider/index.js +++ b/lib/units/provider/index.js @@ -31,7 +31,7 @@ module.exports = function(options) { // port, we must ensure that we allocate ports in fixed groups. var ports = options.ports.slice( 0 - , options.ports.length - options.ports.length % 2 + , options.ports.length - options.ports.length % 4 ) // Information about total devices @@ -317,7 +317,7 @@ module.exports = function(options) { // Spawn a device worker function spawn() { var allocatedPorts = ports.splice(0, 4) - , proc = options.fork(device, allocatedPorts) + , proc = options.fork(device, allocatedPorts.slice()) , resolver = Promise.defer() function exitListener(code, signal) {