Skip to content

Commit

Permalink
fixup! Fix using signaling settings while being refetched
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Aug 16, 2023
1 parent e74272e commit fce3a03
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ Signaling.Base.prototype.setSettings = function(settings) {

this.settings = settings

const pendingUpdateSettingsPromise = this._pendingUpdateSettingsPromise
delete this._pendingUpdateSettingsPromise
if (this._pendingUpdateSettingsPromise) {
const pendingUpdateSettingsPromise = this._pendingUpdateSettingsPromise
delete this._pendingUpdateSettingsPromise

pendingUpdateSettingsPromise.resolve()
pendingUpdateSettingsPromise.resolve()
}
}

Signaling.Base.prototype.isNoMcuWarningEnabled = function() {
Expand Down Expand Up @@ -1450,14 +1452,16 @@ Signaling.Standalone.prototype.processRoomParticipantsEvent = function(data) {
Signaling.Standalone.prototype.processErrorTokenExpired = function() {
console.info('The signaling token is expired, need to update settings')

let pendingUpdateSettingsPromiseResolve
this._pendingUpdateSettingsPromise = new Promise((resolve, reject) => {
// The Promise executor is run even before the Promise constructor has
// finished, so "this._pendingUpdateSettingsPromise" is not available
// yet.
pendingUpdateSettingsPromiseResolve = resolve
})
this._pendingUpdateSettingsPromise.resolve = pendingUpdateSettingsPromiseResolve
if (!this._pendingUpdateSettingsPromise) {
let pendingUpdateSettingsPromiseResolve
this._pendingUpdateSettingsPromise = new Promise((resolve, reject) => {
// The Promise executor is run even before the Promise constructor has
// finished, so "this._pendingUpdateSettingsPromise" is not available
// yet.
pendingUpdateSettingsPromiseResolve = resolve
})
this._pendingUpdateSettingsPromise.resolve = pendingUpdateSettingsPromiseResolve
}

this._trigger('updateSettings')
}
Expand Down

0 comments on commit fce3a03

Please sign in to comment.