From 7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 17 Oct 2026 18:51:35 +0200 Subject: fix(spa): search names the groups refused the local network Search gives up before ICE does, so the refusal is read from the connection then; the walk moves on to the group's other nodes, and the page lists the refused groups with a link to each. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/src/meshbay_hub/static/transport.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/transport.js b/packages/meshbay-hub/src/meshbay_hub/static/transport.js index 11088adc..98a6ecfa 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/transport.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/transport.js @@ -844,6 +844,21 @@ class MeshBayTransport { this._wakeReconnect(); } + /** + * Whether the connection being made is refused the local network, read from + * what is paired so far: the signature is there as soon as ICE checks + * begin, where connect() names it only once ICE gives up, half a minute. + * For a caller that stops waiting before that (connection-pool.js). + */ + async localNetworkRefused() { + const pc = this._pc; + if (!pc || !this._rawAnswerSdp || !pc.localDescription) return false; + if (pc.iceConnectionState === 'connected' || pc.iceConnectionState === 'completed') { + return false; + } + return _localNetworkRefusedBy(pc, pc.localDescription.sdp, this._rawAnswerSdp); + } + get connected() { return this._connected; } /** True while _reconnectLoop is running, backoff included. */ get reconnecting() { return !!this._reconnectPromise; } @@ -1015,6 +1030,7 @@ class MeshBayTransport { // the composer, exactly like one that had. this._setDevicePk('', 'new connection'); this._sessionUp = false; + this._rawAnswerSdp = null; this._pc = new RTCPeerConnection({ iceServers: await iceServers() }); this._channel = this._pc.createDataChannel('mnp', { ordered: true }); -- cgit v1.2.3