diff --git a/public/app.js b/public/app.js index da96622..b1e66f8 100644 --- a/public/app.js +++ b/public/app.js @@ -387,7 +387,13 @@ function createOrphanPeer(id) { function ensurePC(peer, initiator) { if (peer.pc) return peer; - const pc = new RTCPeerConnection({ ...effectiveIce(), iceCandidatePoolSize: 4 }); + const config = { ...effectiveIce(), iceCandidatePoolSize: 4 }; + // After a failed retry, force everything through TURN relay — sidesteps + // AP/router client isolation and NAT-hairpin issues that are common when + // both peers are on the same LAN (direct/STUN candidates get silently + // dropped by the router in that case, so give up trying them). + if (peer.resetAttempts > 0) config.iceTransportPolicy = 'relay'; + const pc = new RTCPeerConnection(config); peer.pc = pc; peer.polite = S.myId > peer.id;