Browse Source

fix: Maybe start p2p only when we have received all presences.

There are cases where we start p2p on the first participant received presence, where there are more presences coming. This starts the process of p2p resulting and few iq errors while terminating it quickly after starting it.
On a normal joining as third participant we see around 38 send or received iq messages, in the problem scenario we see 60.
dev1
damencho 4 years ago
parent
commit
9f65e8fab3
2 changed files with 18 additions and 1 deletions
  1. 16
    1
      JitsiConference.js
  2. 2
    0
      JitsiConferenceEventManager.js

+ 16
- 1
JitsiConference.js View File

1528
 
1528
 
1529
     this._updateFeatures(participant);
1529
     this._updateFeatures(participant);
1530
 
1530
 
1531
-    this._maybeStartOrStopP2P();
1531
+    // maybeStart only if we had finished joining as then we will have information for the number of participants
1532
+    if (this.isJoined()) {
1533
+        this._maybeStartOrStopP2P();
1534
+    }
1535
+
1532
     this._maybeSetSITimeout();
1536
     this._maybeSetSITimeout();
1533
 };
1537
 };
1534
 
1538
 
1535
 /* eslint-enable max-params */
1539
 /* eslint-enable max-params */
1536
 
1540
 
1541
+/**
1542
+ * Get notified when we joined the room.
1543
+ *
1544
+ * FIXME This should NOT be exposed!
1545
+ *
1546
+ * @private
1547
+ */
1548
+JitsiConference.prototype._onMucJoined = function() {
1549
+    this._maybeStartOrStopP2P();
1550
+};
1551
+
1537
 /**
1552
 /**
1538
  * Updates features for a participant.
1553
  * Updates features for a participant.
1539
  * @param {JitsiParticipant} participant - The participant to query for features.
1554
  * @param {JitsiParticipant} participant - The participant to query for features.

+ 2
- 0
JitsiConferenceEventManager.js View File

120
     // send some analytics events
120
     // send some analytics events
121
     chatRoom.addListener(XMPPEvents.MUC_JOINED,
121
     chatRoom.addListener(XMPPEvents.MUC_JOINED,
122
         () => {
122
         () => {
123
+            this.conference._onMucJoined();
124
+
123
             this.conference.isJvbConnectionInterrupted = false;
125
             this.conference.isJvbConnectionInterrupted = false;
124
 
126
 
125
             // TODO: Move all of the 'connectionTimes' logic to its own module.
127
             // TODO: Move all of the 'connectionTimes' logic to its own module.

Loading…
Cancel
Save