diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/config.js | 1 | ||||
-rw-r--r-- | src/lib/workers-list.js | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/config.js b/src/lib/config.js index f3a9e61..4228621 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -71,6 +71,7 @@ function parseWorkerConfig(file) { const raw = readFile(file) const scheme = { + name: {}, host: {required: true}, port: {required: true, type: 'int'}, password: {}, diff --git a/src/lib/workers-list.js b/src/lib/workers-list.js index 3f2246e..c779ec2 100644 --- a/src/lib/workers-list.js +++ b/src/lib/workers-list.js @@ -35,11 +35,12 @@ class WorkersList { /** * @param {Connection} connection * @param {string[]} targets + * @param {string} name */ - add(connection, targets) { - this.logger.info(`add: connection from ${connection.remoteAddr()}, targets ${JSON.stringify(targets)}`) + add(connection, {targets, name}) { + this.logger.info(`add: connection from ${connection.remoteAddr()}, name ${name}, targets ${JSON.stringify(targets)}`) - this.workers.push({connection, targets}) + this.workers.push({connection, targets, name}) connection.on('close', () => { this.logger.info(`connection from ${connection.remoteAddr()} closed, removing worker`) this.workers = this.workers.filter(worker => { @@ -161,7 +162,8 @@ class WorkersList { const workerInfo = { remoteAddr: worker.connection.socket?.remoteAddress, remotePort: worker.connection.socket?.remotePort, - targets: worker.targets + targets: worker.targets, + name: worker.name, } if (pollWorkers) { |