Skip to content

Commit

Permalink
* fix: Fixes double conf requests & always send them after presence e…
Browse files Browse the repository at this point in the history
…rror.

* Revert "fix: Sends conference requests on retries of errors."

Seems we are sending two conference requests in the happy path.

This reverts commit 86e2fb2.

* fix: Sends conference requests on retries of errors.

This changes the behavior of retires when Room creation restricted error is received, we will always send the conference request to jicofo when retrying.
Also, after error for password protected rooms and providing password, a conference request was not send which can result jicofo left the room and error is received.
  • Loading branch information
damencho committed Apr 26, 2024
1 parent 799236d commit 2e2189f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,9 @@ export default class ChatRoom extends Listenable {
this.sendPresence();
}

// we need to reset it because of breakout rooms which will reuse connection but will invite jicofo
this.xmpp.moderator.conferenceRequestSent = false;

this.eventEmitter.emit(XMPPEvents.MUC_JOINED);

// Now let's check the disco-info to retrieve the
Expand Down Expand Up @@ -1216,6 +1219,13 @@ export default class ChatRoom extends Listenable {
onPresenceError(pres, from) {
let errorDescriptionNode;

if (from === this.myroomjid) {
// we have tried to join, and we received an error, let's send again conference-iq on next attempt
// as it may turn out that jicofo left the room if we were the first to try,
// and the user delayed the attempt for entering the password or such
this.xmpp.moderator.conferenceRequestSent = false;
}

if ($(pres)
.find(
'>error[type="auth"]'
Expand Down
12 changes: 12 additions & 0 deletions modules/xmpp/moderator.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,16 @@ export default class Moderator extends Listenable {
* rejected, and it'll keep on pinging Jicofo forever.
*/
sendConferenceRequest(roomJid) {
// there is no point of sending conference iq when in visitor mode (disableFocus)
// when we have sent early the conference request via http
// we want to skip sending it here, or visitors can loop
if (this.conferenceRequestSent) {
return Promise.resolve();
}

// to mark whether we have already sent a conference request
this.conferenceRequestSent = false;

return new Promise(resolve => {
if (this.mode === 'xmpp') {
logger.info(`Sending conference request over XMPP to ${this.targetJid}`);
Expand Down Expand Up @@ -339,6 +349,8 @@ export default class Moderator extends Listenable {
this._handleError(roomJid);
});
}
}).then(() => {
this.conferenceRequestSent = true;
});
}

Expand Down

0 comments on commit 2e2189f

Please sign in to comment.