瀏覽代碼

When we detect version mismatch always retry getting features.

release-8443
damencho 6 年之前
父節點
當前提交
884cf31abc
共有 2 個檔案被更改,包括 21 行新增12 行删除
  1. 5
    11
      JitsiConference.js
  2. 16
    1
      JitsiParticipant.js

+ 5
- 11
JitsiConference.js 查看文件

1352
         id,
1352
         id,
1353
         participant);
1353
         participant);
1354
 
1354
 
1355
-    this._updateFeatures(participant)
1356
-        .catch(() =>
1357
-
1358
-            // there was probably a mismatch, lets try one more time and give up
1359
-            this._updateFeatures(participant)
1360
-                .catch(error => {
1361
-                    logger.warn(`Failed to discover features of ${jid}`, error);
1362
-                }));
1355
+    this._updateFeatures(participant);
1363
 
1356
 
1364
     this._maybeStartOrStopP2P();
1357
     this._maybeStartOrStopP2P();
1365
     this._maybeSetSITimeout();
1358
     this._maybeSetSITimeout();
1370
 /**
1363
 /**
1371
  * Updates features for a participant.
1364
  * Updates features for a participant.
1372
  * @param {JitsiParticipant} participant - The participant to query for features.
1365
  * @param {JitsiParticipant} participant - The participant to query for features.
1373
- * @returns {Promise<Set<String> | never>}
1366
+ * @returns {void}
1374
  * @private
1367
  * @private
1375
  */
1368
  */
1376
 JitsiConference.prototype._updateFeatures = function(participant) {
1369
 JitsiConference.prototype._updateFeatures = function(participant) {
1377
-    return this.xmpp.caps.getFeatures(participant.getJid())
1370
+    participant.getFeatures()
1378
         .then(features => {
1371
         .then(features => {
1379
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
1372
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
1380
             this.updateDTMFSupport();
1373
             this.updateDTMFSupport();
1382
             if (features.has('http://jitsi.org/protocol/jigasi')) {
1375
             if (features.has('http://jitsi.org/protocol/jigasi')) {
1383
                 participant.setProperty('features_jigasi', true);
1376
                 participant.setProperty('features_jigasi', true);
1384
             }
1377
             }
1385
-        });
1378
+        })
1379
+        .catch(() => false);
1386
 };
1380
 };
1387
 
1381
 
1388
 /**
1382
 /**

+ 16
- 1
JitsiParticipant.js 查看文件

1
 
1
 
2
 import { Strophe } from 'strophe.js';
2
 import { Strophe } from 'strophe.js';
3
 
3
 
4
+import { getLogger } from 'jitsi-meet-logger';
5
+
4
 import * as JitsiConferenceEvents from './JitsiConferenceEvents';
6
 import * as JitsiConferenceEvents from './JitsiConferenceEvents';
5
 import { ParticipantConnectionStatus }
7
 import { ParticipantConnectionStatus }
6
     from './modules/connectivity/ParticipantConnectionStatus';
8
     from './modules/connectivity/ParticipantConnectionStatus';
7
 import * as MediaType from './service/RTC/MediaType';
9
 import * as MediaType from './service/RTC/MediaType';
8
 
10
 
11
+const logger = getLogger(__filename);
12
+
9
 /**
13
 /**
10
  * Represents a participant in (i.e. a member of) a conference.
14
  * Represents a participant in (i.e. a member of) a conference.
11
  */
15
  */
234
      * @returns {Promise<Set<String>, Error>}
238
      * @returns {Promise<Set<String>, Error>}
235
      */
239
      */
236
     getFeatures(timeout = 5000) {
240
     getFeatures(timeout = 5000) {
237
-        return this._conference.xmpp.caps.getFeatures(this._jid, timeout);
241
+        return this._conference.xmpp.caps.getFeatures(this._jid, timeout)
242
+            .catch(error => {
243
+                // when we detect version mismatch we return a string as error
244
+                // we want to retry in such case
245
+                if (error && error.constructor === String) {
246
+                    return this._conference.xmpp.caps.getFeatures(this._jid, timeout);
247
+                }
248
+
249
+                logger.warn(`Failed to discover features of ${this._jid}`, error);
250
+
251
+                return Promise.reject(error);
252
+            });
238
     }
253
     }
239
 
254
 
240
     /**
255
     /**

Loading…
取消
儲存