aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/transport.js
diff options
context:
space:
mode:
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 });