Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2022-04-01 22:04:29 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2022-04-01 22:04:29 +0300
commit6d3df1431edc9b88c21ad5825b8fabdcbe85ddee (patch)
treeae0e83a7b1b6204e01f0a1b20e2d8e7abce8639b /src/utils/signaling.js
parent0167394dd339de30d25a4eda148987d557e6e34f (diff)
Fix not joining call again due to call flags in forced reconnections
When the HPB is not used forcing a reconnection causes the call to be left and then joined again. Although it was waited for the call to be left first before joining again in some cases it could happen that, after sending the join request but before receiving its response, the "usersInRoom" event was received. In that case the call flags for the participant will be "disconnected" (as at this point it is actually disconnected), but as the join request was already sent it is seen as "a moderator ended the call", and thus the call is left again. To prevent that now it is explicitly waited for the "disconnected" flags to be received and, then, the call is joined again. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src/utils/signaling.js')
-rw-r--r--src/utils/signaling.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js
index 7e00d75a3..84964793e 100644
--- a/src/utils/signaling.js
+++ b/src/utils/signaling.js
@@ -360,6 +360,8 @@ function Internal(settings) {
this.sendInterval = window.setInterval(function() {
this.sendPendingMessages()
}.bind(this), 500)
+
+ this._joinCallAgainOnceDisconnected = false
}
Internal.prototype = new Signaling.Base()
@@ -399,7 +401,7 @@ Signaling.Internal.prototype.forceReconnect = function(newSession, flags) {
// FIXME Naive reconnection routine; as the same session is kept peers
// must be explicitly ended before the reconnection is forced.
this.leaveCall(this.currentCallToken, true).then(() => {
- this.joinCall(this.currentCallToken, this.currentCallFlags)
+ this._joinCallAgainOnceDisconnected = true
})
}
@@ -425,11 +427,14 @@ Signaling.Internal.prototype._sendMessages = function(messages) {
}
Signaling.Internal.prototype._joinRoomSuccess = function(token, sessionId) {
+ this._joinCallAgainOnceDisconnected = false
+
this.sessionId = sessionId
this._startPullingMessages()
}
Signaling.Internal.prototype._doLeaveRoom = function(token) {
+ this._joinCallAgainOnceDisconnected = false
}
Signaling.Internal.prototype.sendCallMessage = function(data) {
@@ -471,11 +476,20 @@ Signaling.Internal.prototype._startPullingMessages = function() {
}
result.data.ocs.data.forEach(message => {
+ let localParticipant
+
this._trigger('onBeforeReceiveMessage', [message])
switch (message.type) {
case 'usersInRoom':
this._trigger('usersInRoom', [message.data])
this._trigger('participantListChanged')
+
+ localParticipant = message.data.find(participant => participant.sessionId === this.sessionId)
+ if (this._joinCallAgainOnceDisconnected && !localParticipant.inCall) {
+ this._joinCallAgainOnceDisconnected = false
+ this.joinCall(this.currentCallToken, this.currentCallFlags)
+ }
+
break
case 'message':
if (typeof (message.data) === 'string') {