Room-Code: Retry in joinFromRoomCode (10x500ms) für Offer-Race-Condition

This commit is contained in:
Ole 2026-06-13 22:46:44 +02:00
parent 2a86156d95
commit 1e7262ee24

6
p2p.js
View file

@ -175,11 +175,13 @@ class MeshNet {
this._pendingPeer = { peer, peerId: remoteId, connected: answerSent };
}
joinFromRoomCode(code) {
joinFromRoomCode(code, _retries = 10) {
const key = `rp2p_offer_${code.toUpperCase()}`;
const offerStr = localStorage.getItem(key);
if (!offerStr) {
console.error('Room not found:', code);
if (_retries > 0) {
setTimeout(() => this.joinFromRoomCode(code, _retries - 1), 500);
}
return;
}
const offerData = JSON.parse(offerStr);