ソースを参照

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,14 +1352,7 @@ JitsiConference.prototype.onMemberJoined = function(
1352 1352
         id,
1353 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 1357
     this._maybeStartOrStopP2P();
1365 1358
     this._maybeSetSITimeout();
@@ -1370,11 +1363,11 @@ JitsiConference.prototype.onMemberJoined = function(
1370 1363
 /**
1371 1364
  * Updates features for a participant.
1372 1365
  * @param {JitsiParticipant} participant - The participant to query for features.
1373
- * @returns {Promise<Set<String> | never>}
1366
+ * @returns {void}
1374 1367
  * @private
1375 1368
  */
1376 1369
 JitsiConference.prototype._updateFeatures = function(participant) {
1377
-    return this.xmpp.caps.getFeatures(participant.getJid())
1370
+    participant.getFeatures()
1378 1371
         .then(features => {
1379 1372
             participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
1380 1373
             this.updateDTMFSupport();
@@ -1382,7 +1375,8 @@ JitsiConference.prototype._updateFeatures = function(participant) {
1382 1375
             if (features.has('http://jitsi.org/protocol/jigasi')) {
1383 1376
                 participant.setProperty('features_jigasi', true);
1384 1377
             }
1385
-        });
1378
+        })
1379
+        .catch(() => false);
1386 1380
 };
1387 1381
 
1388 1382
 /**

+ 16
- 1
JitsiParticipant.js ファイルの表示

@@ -1,11 +1,15 @@
1 1
 
2 2
 import { Strophe } from 'strophe.js';
3 3
 
4
+import { getLogger } from 'jitsi-meet-logger';
5
+
4 6
 import * as JitsiConferenceEvents from './JitsiConferenceEvents';
5 7
 import { ParticipantConnectionStatus }
6 8
     from './modules/connectivity/ParticipantConnectionStatus';
7 9
 import * as MediaType from './service/RTC/MediaType';
8 10
 
11
+const logger = getLogger(__filename);
12
+
9 13
 /**
10 14
  * Represents a participant in (i.e. a member of) a conference.
11 15
  */
@@ -234,7 +238,18 @@ export default class JitsiParticipant {
234 238
      * @returns {Promise<Set<String>, Error>}
235 239
      */
236 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
     /**

読み込み中…
キャンセル
保存