fix(visitors): Leave and disconnect before connecting. (#13362)

* fix(visitors): Leave and disconnect before connecting.

The finally was causing the disconnect to be executed after the connect method.

* squash: disconnect and on error.

* squash: updates ljm with a fix that can break strophe listeners.
pull/13365/head jitsi-meet_8671
Дамян Минков 2 years ago committed by GitHub
parent 20f2bfa449
commit 475c2f4606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      conference.js
  2. 10
      package-lock.json
  3. 2
      package.json

@ -361,11 +361,11 @@ class ConferenceConnector {
const [ vnode ] = params;
APP.store.dispatch(overwriteConfig(newConfig))
.then(this._conference.leaveRoom())
.then(APP.store.dispatch(setIAmVisitor(Boolean(vnode))))
.then(() => this._conference.leaveRoom())
.then(() => APP.store.dispatch(setIAmVisitor(Boolean(vnode))))
// we do not clear local tracks on error, so we need to manually clear them
.then(APP.store.dispatch(destroyLocalTracks()))
.then(() => APP.store.dispatch(destroyLocalTracks()))
.then(() => {
// Reset VideoLayout. It's destroyed in features/video-layout/middleware.web.js so re-initialize it.
VideoLayout.initLargeVideo();
@ -418,7 +418,7 @@ class ConferenceConnector {
if (newConfig) {
APP.store.dispatch(overwriteConfig(newConfig))
.then(this._conference.leaveRoom())
.then(() => this._conference.leaveRoom())
.then(() => {
_connectionPromise = connect(this._conference.roomName);
@ -2620,17 +2620,22 @@ export default {
async leaveRoom(doDisconnect = true, reason = '') {
APP.store.dispatch(conferenceWillLeave(room));
const maybeDisconnect = () => {
if (doDisconnect) {
return disconnect();
}
};
if (room && room.isJoined()) {
return room.leave(reason).finally(() => {
if (doDisconnect) {
return disconnect();
}
return room.leave(reason).then(() => maybeDisconnect())
.catch(e => {
logger.error(e);
return maybeDisconnect();
});
}
if (doDisconnect) {
return disconnect();
}
return maybeDisconnect();
},
/**

10
package-lock.json generated

@ -60,7 +60,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1635.0.0+152fdb21/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1636.0.0+f429c05f/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",
@ -12742,8 +12742,8 @@
},
"node_modules/lib-jitsi-meet": {
"version": "0.0.0",
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1635.0.0+152fdb21/lib-jitsi-meet.tgz",
"integrity": "sha512-zihPwmE0lO/dFKVQBO12w2ojJST6h/tpxT3ShyvKZUFUUAWa0MfFQx7HvuyEUAOjKmzeivFLSCsvGOyBMSbMqA==",
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1636.0.0+f429c05f/lib-jitsi-meet.tgz",
"integrity": "sha512-Au4t6wJu8j4TX9ndgkLdwAqdWC6D0jhM8Q1LEKKZGAO/DLJSqenSggjQaR8eu8E8E+M/0sFsISeqpsxkjC6FbA==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
@ -29128,8 +29128,8 @@
}
},
"lib-jitsi-meet": {
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1635.0.0+152fdb21/lib-jitsi-meet.tgz",
"integrity": "sha512-zihPwmE0lO/dFKVQBO12w2ojJST6h/tpxT3ShyvKZUFUUAWa0MfFQx7HvuyEUAOjKmzeivFLSCsvGOyBMSbMqA==",
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1636.0.0+f429c05f/lib-jitsi-meet.tgz",
"integrity": "sha512-Au4t6wJu8j4TX9ndgkLdwAqdWC6D0jhM8Q1LEKKZGAO/DLJSqenSggjQaR8eu8E8E+M/0sFsISeqpsxkjC6FbA==",
"requires": {
"@jitsi/js-utils": "2.0.0",
"@jitsi/logger": "2.0.0",

@ -65,7 +65,7 @@
"js-md5": "0.6.1",
"js-sha512": "0.8.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1635.0.0+152fdb21/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1636.0.0+f429c05f/lib-jitsi-meet.tgz",
"lodash": "4.17.21",
"moment": "2.29.4",
"moment-duration-format": "2.2.2",

Loading…
Cancel
Save