Bladeren bron

Remove isModerator logic from P2P call start to avoid Duplicated P2P “session-initiate” in the 2 pears and allow P2P without moderator.

dev1
Damien Fetis 6 jaren geleden
bovenliggende
commit
c1ece37538
1 gewijzigde bestanden met toevoegingen van 14 en 26 verwijderingen
  1. 14
    26
      JitsiConference.js

+ 14
- 26
JitsiConference.js Bestand weergeven

@@ -1506,9 +1506,6 @@ JitsiConference.prototype.onLocalRoleChanged = function(role) {
1506 1506
     // Emit role changed for local  JID
1507 1507
     this.eventEmitter.emit(
1508 1508
         JitsiConferenceEvents.USER_ROLE_CHANGED, this.myUserId(), role);
1509
-
1510
-    // Maybe start P2P
1511
-    this._maybeStartOrStopP2P();
1512 1509
 };
1513 1510
 
1514 1511
 JitsiConference.prototype.onUserRoleChanged = function(jid, role) {
@@ -1665,16 +1662,8 @@ JitsiConference.prototype._onIncomingCallP2P = function(
1665 1662
         jingleOffer) {
1666 1663
 
1667 1664
     let rejectReason;
1668
-    const role = this.room.getMemberRole(jingleSession.remoteJid);
1669 1665
 
1670
-    if (role !== 'moderator') {
1671
-        rejectReason = {
1672
-            reason: 'security-error',
1673
-            reasonDescription: 'Only focus can start new sessions',
1674
-            errorMsg: 'Rejecting session-initiate from non-focus and'
1675
-                        + `non-moderator user: ${jingleSession.remoteJid}`
1676
-        };
1677
-    } else if (!browser.supportsP2P()) {
1666
+    if (!browser.supportsP2P()) {
1678 1667
         rejectReason = {
1679 1668
             reason: 'unsupported-applications',
1680 1669
             reasonDescription: 'P2P not supported',
@@ -2951,26 +2940,25 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
2951 2940
     }
2952 2941
 
2953 2942
     // Start peer to peer session
2954
-    if (isModerator && !this.p2pJingleSession && shouldBeInP2P) {
2943
+    if (!this.p2pJingleSession && shouldBeInP2P) {
2955 2944
         const peer = peerCount && peers[0];
2956 2945
 
2957
-        // Everyone is a moderator ?
2958
-        if (isModerator && peer.getRole() === 'moderator') {
2959
-            const myId = this.myUserId();
2960
-            const peersId = peer.getId();
2961 2946
 
2962
-            if (myId > peersId) {
2963
-                logger.debug(
2964
-                    'Everyone\'s a moderator - '
2965
-                    + 'the other peer should start P2P', myId, peersId);
2947
+        const myId = this.myUserId();
2948
+        const peersId = peer.getId();
2966 2949
 
2967
-                return;
2968
-            } else if (myId === peersId) {
2969
-                logger.error('The same IDs ? ', myId, peersId);
2950
+        if (myId > peersId) {
2951
+            logger.debug(
2952
+                'I\'m the bigger peersId - '
2953
+                + 'the other peer should start P2P', myId, peersId);
2970 2954
 
2971
-                return;
2972
-            }
2955
+            return;
2956
+        } else if (myId === peersId) {
2957
+            logger.error('The same IDs ? ', myId, peersId);
2958
+
2959
+            return;
2973 2960
         }
2961
+
2974 2962
         const jid = peer.getJid();
2975 2963
 
2976 2964
         if (userLeftEvent) {

Laden…
Annuleren
Opslaan