Give open device ports their own options. Preparing for future refactor.

This commit is contained in:
Simo Kinnunen
2015-04-29 16:38:03 +09:00
parent b3b538c561
commit 105795bec7
4 changed files with 19 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ module.exports = syrup.serial()
, plugin = Object.create(null)
, activeServer = null
plugin.port = options.ports.pop()
plugin.port = options.connectPort
plugin.url = util.format('%s:%s', options.publicIp, plugin.port)
plugin.start = function() {

View File

@@ -6,7 +6,7 @@ module.exports = syrup.serial()
var plugin = Object.create(null)
plugin.devicePort = 9002
plugin.publicPort = options.ports.pop()
plugin.publicPort = options.screenPort
plugin.publicUrl = _.template(options.screenWsUrlPattern)({
publicIp: options.publicIp
, publicPort: plugin.publicPort

View File

@@ -32,7 +32,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 % 4
, options.ports.length - options.ports.length % 2
)
// Information about total devices
@@ -303,7 +303,7 @@ module.exports = function(options) {
// Spawn a device worker
function spawn() {
var allocatedPorts = ports.splice(0, 4)
var allocatedPorts = ports.splice(0, 2)
, proc = options.fork(device, allocatedPorts)
, resolver = Promise.defer()