From 9a8e882b88c6ebabdf20bbfdd0dbbd70c158153e Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Wed, 8 Oct 2025 17:51:38 -0400 Subject: [PATCH 1/3] fix: Don't use getAddress in start/stop of local-discovery --- src/discovery/local-discovery.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/discovery/local-discovery.js b/src/discovery/local-discovery.js index 0955f958e..24bb0df5a 100644 --- a/src/discovery/local-discovery.js +++ b/src/discovery/local-discovery.js @@ -75,7 +75,8 @@ export class LocalDiscovery extends TypedEmitter { /** @returns {Promise<{ name: string, port: number }>} */ async start() { await this.#sm.start() - return { name: this.#name, port: getAddress(this.#server).port } + const port = this.#port + return { name: this.#name, port } } /** @returns {Promise} */ @@ -288,7 +289,7 @@ export class LocalDiscovery extends TypedEmitter { */ async #stop({ force = false, timeout = 0 } = {}) { this.#log('stopping') - const { port } = getAddress(this.#server) + const port = this.#port this.#server.close() const closePromise = once(this.#server, 'close') From e37f0370811a08f6e65657221b4c4920a1314b9e Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Mon, 13 Oct 2025 11:46:20 -0400 Subject: [PATCH 2/3] chore: move discovery port setting from #start() to start() --- src/discovery/local-discovery.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/discovery/local-discovery.js b/src/discovery/local-discovery.js index 24bb0df5a..2a8b4df0e 100644 --- a/src/discovery/local-discovery.js +++ b/src/discovery/local-discovery.js @@ -75,7 +75,9 @@ export class LocalDiscovery extends TypedEmitter { /** @returns {Promise<{ name: string, port: number }>} */ async start() { await this.#sm.start() - const port = this.#port + const { port } = getAddress(this.#server) + this.#port = port + this.#log('server listening on port ' + port) return { name: this.#name, port } } @@ -93,9 +95,6 @@ export class LocalDiscovery extends TypedEmitter { this.#port = 0 return this.#start() } - const addr = getAddress(this.#server) - this.#port = addr.port - this.#log('server listening on port ' + addr.port) } /** From 778afd7a606f53c5320cb46eb12de363e8f90bef Mon Sep 17 00:00:00 2001 From: Mauve Signweaver Date: Tue, 14 Oct 2025 11:50:24 -0400 Subject: [PATCH 3/3] Revert "chore: move discovery port setting from #start() to start()" This reverts commit e37f0370811a08f6e65657221b4c4920a1314b9e. --- src/discovery/local-discovery.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/discovery/local-discovery.js b/src/discovery/local-discovery.js index 2a8b4df0e..24bb0df5a 100644 --- a/src/discovery/local-discovery.js +++ b/src/discovery/local-discovery.js @@ -75,9 +75,7 @@ export class LocalDiscovery extends TypedEmitter { /** @returns {Promise<{ name: string, port: number }>} */ async start() { await this.#sm.start() - const { port } = getAddress(this.#server) - this.#port = port - this.#log('server listening on port ' + port) + const port = this.#port return { name: this.#name, port } } @@ -95,6 +93,9 @@ export class LocalDiscovery extends TypedEmitter { this.#port = 0 return this.#start() } + const addr = getAddress(this.#server) + this.#port = addr.port + this.#log('server listening on port ' + addr.port) } /**