Parcourir la source

Merge pull request #202 from jitsi/session_accept_timeout

Fix session-accept timeout
master
George Politis il y a 9 ans
Parent
révision
701a5e7e9b
3 fichiers modifiés avec 37 ajouts et 7 suppressions
  1. 4
    4
      JitsiConferenceEventManager.js
  2. 22
    3
      modules/xmpp/JingleSessionPC.js
  3. 11
    0
      service/xmpp/XMPPEvents.js

+ 4
- 4
JitsiConferenceEventManager.js Voir le fichier

@@ -178,10 +178,10 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
178 178
                     JitsiConferenceErrors.FOCUS_LEFT);
179 179
         });
180 180
 
181
-    chatRoom.addListener(XMPPEvents.ALLOCATE_FOCUS_MAX_RETRIES_ERROR,
182
-        function () {
183
-            conference.connection._reload();
184
-        });
181
+    var reloadHandler = function () { conference.connection._reload(); };
182
+    chatRoom.addListener(
183
+        XMPPEvents.ALLOCATE_FOCUS_MAX_RETRIES_ERROR, reloadHandler);
184
+    chatRoom.addListener(XMPPEvents.SESSION_ACCEPT_TIMEOUT, reloadHandler);
185 185
 
186 186
     this.chatRoomForwarder.forward(XMPPEvents.CONNECTION_INTERRUPTED,
187 187
         JitsiConferenceEvents.CONNECTION_INTERRUPTED);

+ 22
- 3
modules/xmpp/JingleSessionPC.js Voir le fichier

@@ -435,15 +435,34 @@ JingleSessionPC.prototype.sendSessionAccept = function (localSDP,
435 435
     // Calling tree() to print something useful
436 436
     accept = accept.tree();
437 437
     logger.info("Sending session-accept", accept);
438
-
438
+    var self = this;
439 439
     this.connection.sendIQ(accept,
440 440
         success,
441
-        this.newJingleErrorHandler(accept, failure),
441
+        this.newJingleErrorHandler(accept, function (error) {
442
+            failure(error);
443
+            // 'session-accept' is a critical timeout and we'll have to restart
444
+            self.room.eventEmitter.emit(XMPPEvents.SESSION_ACCEPT_TIMEOUT);
445
+        }),
442 446
         IQ_TIMEOUT);
443 447
     // XXX Videobridge needs WebRTC's answer (ICE ufrag and pwd, DTLS
444 448
     // fingerprint and setup) ASAP in order to start the connection
445 449
     // establishment.
446
-    this.connection.flush();
450
+    //
451
+    // FIXME Flushing the connection at this point triggers an issue with BOSH
452
+    // request handling in Prosody on slow connections.
453
+    //
454
+    // The problem is that this request will be quite large and it may take time
455
+    // before it reaches Prosody. In the meantime Strophe may decide to send
456
+    // the next one. And it was observed that a small request with
457
+    // 'transport-info' usually follows this one. It does reach Prosody before
458
+    // the previous one was completely received. 'rid' on the server is
459
+    // increased and Prosody ignores the request with 'session-accept'. It will
460
+    // never reach Jicofo and everything in the request table is lost. Removing
461
+    // the flush does not guarantee it will never happen, but makes it much less
462
+    // likely('transport-info' is bundled with 'session-accept' and any
463
+    // immediate requests).
464
+    //
465
+    // this.connection.flush();
447 466
 };
448 467
 
449 468
 /**

+ 11
- 0
service/xmpp/XMPPEvents.js Voir le fichier

@@ -144,6 +144,17 @@ var XMPPEvents = {
144 144
      * Indicates that the local sendrecv streams in local SDP are changed.
145 145
      */
146 146
     SENDRECV_STREAMS_CHANGED: "xmpp.sendrecv_streams_changed",
147
+    /**
148
+     * Event fired when we do not get our 'session-accept' acknowledged by
149
+     * Jicofo. It most likely means that there is serious problem with our
150
+     * connection or XMPP server and we should reload the conference.
151
+     *
152
+     * We have seen that to happen in BOSH requests race condition when the BOSH
153
+     * request table containing the 'session-accept' was discarded by Prosody.
154
+     * Jicofo does send the RESULT immediately without any condition, so missing
155
+     * packets means that most likely it has never seen our IQ.
156
+     */
157
+    SESSION_ACCEPT_TIMEOUT: "xmpp.session_accept_timeout",
147 158
     // TODO: only used in a hack, should probably be removed.
148 159
     SET_LOCAL_DESCRIPTION_ERROR: 'xmpp.set_local_description_error',
149 160
 

Chargement…
Annuler
Enregistrer