aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transport.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-17 18:51:35 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-17 18:51:35 +0200
commit7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf (patch)
tree9b5d0aae04e226e1f3c7187a4866ee421544f7a4 /packages/meshbay-hub/src/meshbay_hub/static/transport.js
parent8125df6d8149368ed8a84c9db6c5e37bfccb5a15 (diff)
downloadmeshbay-7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf.tar.gz
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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/transport.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/transport.js16
1 files changed, 16 insertions, 0 deletions
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 });