Selaa lähdekoodia

fix(P2P): do not accept P2P if disabled

Will not accept incoming P2P session if it's disabled in the config.
dev1
paweldomas 8 vuotta sitten
vanhempi
commit
23a374e0c1
1 muutettua tiedostoa jossa 19 lisäystä ja 5 poistoa
  1. 19
    5
      JitsiConference.js

+ 19
- 5
JitsiConference.js Näytä tiedosto

302
     return this.room && this.room.joined;
302
     return this.room && this.room.joined;
303
 };
303
 };
304
 
304
 
305
+/**
306
+ * Tells whether or not the P2P mode is enabled in the configuration.
307
+ * @return {boolean}
308
+ */
309
+JitsiConference.prototype.isP2PEnabled = function() {
310
+    return Boolean(this.options.config.p2p && this.options.config.p2p.enabled)
311
+
312
+        // FIXME: remove once we have a default config template. -saghul
313
+        || typeof this.options.config.p2p === 'undefined';
314
+};
315
+
305
 /**
316
 /**
306
  * Leaves the conference.
317
  * Leaves the conference.
307
  * @returns {Promise}
318
  * @returns {Promise}
1306
                     reasonMsg: 'P2P not supported',
1317
                     reasonMsg: 'P2P not supported',
1307
                     errorMsg: 'This client does not support P2P connections'
1318
                     errorMsg: 'This client does not support P2P connections'
1308
                 });
1319
                 });
1320
+        } else if (!this.isP2PEnabled()) {
1321
+            this._rejectIncomingCall(
1322
+                jingleSession, {
1323
+                    reasonTag: 'decline',
1324
+                    reasonMsg: 'P2P disabled',
1325
+                    errorMsg: 'P2P mode disabled in the configuration'
1326
+                });
1309
         } else if (this.p2pJingleSession) {
1327
         } else if (this.p2pJingleSession) {
1310
             // Reject incoming P2P call (already in progress)
1328
             // Reject incoming P2P call (already in progress)
1311
             this._rejectIncomingCall(
1329
             this._rejectIncomingCall(
2299
  * @private
2317
  * @private
2300
  */
2318
  */
2301
 JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2319
 JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2302
-    if (!(RTCBrowserType.isP2PSupported()
2303
-            && ((this.options.config.p2p && this.options.config.p2p.enabled)
2304
-
2305
-            // FIXME: remove once we have a default config template. -saghul
2306
-            || typeof this.options.config.p2p === 'undefined'))) {
2320
+    if (!RTCBrowserType.isP2PSupported() || !this.isP2PEnabled()) {
2307
         logger.info('Auto P2P disabled');
2321
         logger.info('Auto P2P disabled');
2308
 
2322
 
2309
         return;
2323
         return;

Loading…
Peruuta
Tallenna