Преглед на файлове

Allows testing how synchronous and asynchronous Strophe affects the reliability of the delivery of unavailable presence to the XMPP server.

dev1
Lyubomir Marinov преди 9 години
родител
ревизия
21d5049076
променени са 4 файла, в които са добавени 14061 реда и са изтрити 13830 реда
  1. 7
    1
      JitsiConnection.js
  2. 14013
    13811
      lib-jitsi-meet.js
  3. 16
    16
      lib-jitsi-meet.min.js
  4. 25
    2
      modules/xmpp/xmpp.js

+ 7
- 1
JitsiConnection.js Целия файл

32
  * Disconnect the client from the server.
32
  * Disconnect the client from the server.
33
  */
33
  */
34
 JitsiConnection.prototype.disconnect = function () {
34
 JitsiConnection.prototype.disconnect = function () {
35
-    this.xmpp.disconnect();
35
+    // XXX Forward any arguments passed to JitsiConnection.disconnect to
36
+    // XMPP.disconnect. For example, the caller of JitsiConnection.disconnect
37
+    // may optionally pass the event which triggered the disconnect in order to
38
+    // provide the implementation with finer-grained context.
39
+    var x = this.xmpp;
40
+
41
+    x.disconnect.apply(x, arguments);
36
 }
42
 }
37
 
43
 
38
 /**
44
 /**

+ 14013
- 13811
lib-jitsi-meet.js
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 16
- 16
lib-jitsi-meet.min.js
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 25
- 2
modules/xmpp/xmpp.js Целия файл

290
     return this.connection.jingle.sessions;
290
     return this.connection.jingle.sessions;
291
 };
291
 };
292
 
292
 
293
-XMPP.prototype.disconnect = function () {
293
+/**
294
+ * Disconnects this from the XMPP server (if this is connected).
295
+ *
296
+ * @param ev optionally, the event which triggered the necessity to disconnect
297
+ * from the XMPP server (e.g. beforeunload, unload)
298
+ */
299
+XMPP.prototype.disconnect = function (ev) {
294
     if (this.disconnectInProgress
300
     if (this.disconnectInProgress
295
             || !this.connection
301
             || !this.connection
296
             || !this.connection.connected) {
302
             || !this.connection.connected) {
312
     // once more after disconnect() in order to attempt to have its unavailable
318
     // once more after disconnect() in order to attempt to have its unavailable
313
     // presence sent as soon as possible.
319
     // presence sent as soon as possible.
314
     this.connection.flush();
320
     this.connection.flush();
321
+
322
+    if (ev !== null && typeof ev !== 'undefined') {
323
+        var evType = ev.type;
324
+
325
+        if (evType == 'beforeunload' || evType == 'unload') {
326
+            // XXX Whatever we said above, synchronous sending is the best
327
+            // (known) way to properly disconnect from the XMPP server.
328
+            // Consequently, it may be fine to have the source code and comment
329
+            // it in or out depending on whether we want to run with it for some
330
+            // time.
331
+            this.connection.options.sync = true;
332
+        }
333
+    }
334
+
315
     this.connection.disconnect();
335
     this.connection.disconnect();
316
-    this.connection.flush();
336
+
337
+    if (this.connection.options.sync !== true) {
338
+        this.connection.flush();
339
+    }
317
 };
340
 };
318
 
341
 
319
 module.exports = XMPP;
342
 module.exports = XMPP;

Loading…
Отказ
Запис