From 475c2f4606cea0dbc43fe47ef7c5f33ff1a3f31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Tue, 16 May 2023 16:24:26 -0500 Subject: [PATCH] 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. --- conference.js | 27 ++++++++++++++++----------- package-lock.json | 10 +++++----- package.json | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/conference.js b/conference.js index d9d3e4edf8..0695c216e5 100644 --- a/conference.js +++ b/conference.js @@ -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(); }, /** diff --git a/package-lock.json b/package-lock.json index 9bd8a06484..00363c97e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 14d0fae4de..6806d5a46f 100644 --- a/package.json +++ b/package.json @@ -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",