Sfoglia il codice sorgente

Delete old session ID and retry on 'session-invalid' response. Updates app.bundle.js.

j8
paweldomas 10 anni fa
parent
commit
e16cee4187
3 ha cambiato i file con 50 aggiunte e 40 eliminazioni
  1. 1
    1
      index.html
  2. 26
    20
      libs/app.bundle.js
  3. 23
    19
      modules/xmpp/moderator.js

+ 1
- 1
index.html Vedi File

@@ -19,7 +19,7 @@
19 19
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
20 20
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
21 21
     <script src="interface_config.js?v=5"></script>
22
-    <script src="libs/app.bundle.js?v=12"></script>
22
+    <script src="libs/app.bundle.js?v=13"></script>
23 23
 
24 24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25 25
     <link rel="stylesheet" href="css/font.css?v=6"/>

+ 26
- 20
libs/app.bundle.js Vedi File

@@ -627,7 +627,7 @@ var DataChannels =
627 627
             // selections so that it can do adaptive simulcast,
628 628
             // we want the notification to trigger even if userJid is undefined,
629 629
             // or null.
630
-            var userJid = APP.UI.getLargeVideoState().userJid;
630
+            var userJid = APP.UI.getLargeVideoState().userResourceJid;
631 631
             // we want the notification to trigger even if userJid is undefined,
632 632
             // or null.
633 633
             onSelectedEndpointChanged(userJid);
@@ -785,6 +785,8 @@ function onSelectedEndpointChanged(userResource)
785 785
         _dataChannels.some(function (dataChannel) {
786 786
             if (dataChannel.readyState == 'open')
787 787
             {
788
+                console.log('sending selected endpoint changed ' 
789
+                    + 'notification to the bridge: ', userResource);
788 790
                 dataChannel.send(JSON.stringify({
789 791
                     'colibriClass': 'SelectedEndpointChangedEvent',
790 792
                     'selectedEndpoint':
@@ -14695,7 +14697,7 @@ module.exports = TraceablePeerConnection;
14695 14697
 
14696 14698
 
14697 14699
 },{}],53:[function(require,module,exports){
14698
-/* global $, $iq, config, connection, UI, messageHandler,
14700
+/* global $, $iq, APP, config, connection, UI, messageHandler,
14699 14701
  roomName, sessionTerminated, Strophe, Util */
14700 14702
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
14701 14703
 var Settings = require("../settings/Settings");
@@ -14964,45 +14966,49 @@ var Moderator = {
14964 14966
                 }
14965 14967
             },
14966 14968
             function (error) {
14969
+                // Invalid session ? remove and try again
14970
+                // without session ID to get a new one
14971
+                var invalidSession
14972
+                    = $(error).find('>error>session-invalid').length;
14973
+                if (invalidSession) {
14974
+                    console.info("Session expired! - removing");
14975
+                    localStorage.removeItem("sessionId");
14976
+                }
14967 14977
                 // Not authorized to create new room
14968 14978
                 if ($(error).find('>error>not-authorized').length) {
14969 14979
                     console.warn("Unauthorized to start the conference", error);
14970
-
14971
-                    if ($(error).find('>error>session-invalid').length) {
14972
-                        // FIXME: just retry
14973
-                        console.info("Session expired! - removing");
14974
-                        localStorage.removeItem("sessionId");
14975
-                    }
14976
-
14977 14980
                     var toDomain
14978 14981
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
14979 14982
                     if (toDomain === config.hosts.anonymousdomain) {
14980 14983
                         // we are connected with anonymous domain and
14981 14984
                         // only non anonymous users can create rooms
14982 14985
                         // we must authorize the user
14983
-
14984 14986
                         self.xmppService.promptLogin();
14985 14987
                     } else {
14986
-
14987
-                        eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
14988
+                        // External authentication mode
14989
+                        eventEmitter.emit(
14990
+                            XMPPEvents.AUTHENTICATION_REQUIRED,
14988 14991
                             function () {
14989 14992
                                 Moderator.allocateConferenceFocus(
14990 14993
                                     roomName, callback);
14991 14994
                             });
14992
-
14993 14995
                     }
14994 14996
                     return;
14995 14997
                 }
14996 14998
                 var waitMs = getNextErrorTimeout();
14997 14999
                 console.error("Focus error, retry after " + waitMs, error);
14998 15000
                 // Show message
14999
-                APP.UI.messageHandler.notify( null, "notify.focus",
15000
-                    'Conference focus', 'disconnected',"notify.focusFail",
15001
-                        Moderator.getFocusComponent() +
15002
-                        ' not available - retry in ' +
15003
-                        (waitMs / 1000) + ' sec',
15004
-                    {component: Moderator.getFocusComponent(),
15005
-                        ms: (waitMs / 1000)});
15001
+                var focusComponent = Moderator.getFocusComponent();
15002
+                var retrySec = waitMs / 1000;
15003
+                // FIXME: message is duplicated ?
15004
+                // Do not show in case of session invalid
15005
+                // which means just a retry
15006
+                if (!invalidSession) {
15007
+                    APP.UI.messageHandler.notify(
15008
+                        null, "notify.focus",
15009
+                        'Conference focus', 'disconnected', "notify.focusFail",
15010
+                        {component: focusComponent, ms: retrySec});
15011
+                }
15006 15012
                 // Reset response timeout
15007 15013
                 getNextTimeout(true);
15008 15014
                 window.setTimeout(

+ 23
- 19
modules/xmpp/moderator.js Vedi File

@@ -1,4 +1,4 @@
1
-/* global $, $iq, config, connection, UI, messageHandler,
1
+/* global $, $iq, APP, config, connection, UI, messageHandler,
2 2
  roomName, sessionTerminated, Strophe, Util */
3 3
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
4 4
 var Settings = require("../settings/Settings");
@@ -267,45 +267,49 @@ var Moderator = {
267 267
                 }
268 268
             },
269 269
             function (error) {
270
+                // Invalid session ? remove and try again
271
+                // without session ID to get a new one
272
+                var invalidSession
273
+                    = $(error).find('>error>session-invalid').length;
274
+                if (invalidSession) {
275
+                    console.info("Session expired! - removing");
276
+                    localStorage.removeItem("sessionId");
277
+                }
270 278
                 // Not authorized to create new room
271 279
                 if ($(error).find('>error>not-authorized').length) {
272 280
                     console.warn("Unauthorized to start the conference", error);
273
-
274
-                    if ($(error).find('>error>session-invalid').length) {
275
-                        // FIXME: just retry
276
-                        console.info("Session expired! - removing");
277
-                        localStorage.removeItem("sessionId");
278
-                    }
279
-
280 281
                     var toDomain
281 282
                         = Strophe.getDomainFromJid(error.getAttribute('to'));
282 283
                     if (toDomain === config.hosts.anonymousdomain) {
283 284
                         // we are connected with anonymous domain and
284 285
                         // only non anonymous users can create rooms
285 286
                         // we must authorize the user
286
-
287 287
                         self.xmppService.promptLogin();
288 288
                     } else {
289
-
290
-                        eventEmitter.emit(XMPPEvents.AUTHENTICATION_REQUIRED, // External authentication mode
289
+                        // External authentication mode
290
+                        eventEmitter.emit(
291
+                            XMPPEvents.AUTHENTICATION_REQUIRED,
291 292
                             function () {
292 293
                                 Moderator.allocateConferenceFocus(
293 294
                                     roomName, callback);
294 295
                             });
295
-
296 296
                     }
297 297
                     return;
298 298
                 }
299 299
                 var waitMs = getNextErrorTimeout();
300 300
                 console.error("Focus error, retry after " + waitMs, error);
301 301
                 // Show message
302
-                APP.UI.messageHandler.notify( null, "notify.focus",
303
-                    'Conference focus', 'disconnected',"notify.focusFail",
304
-                        Moderator.getFocusComponent() +
305
-                        ' not available - retry in ' +
306
-                        (waitMs / 1000) + ' sec',
307
-                    {component: Moderator.getFocusComponent(),
308
-                        ms: (waitMs / 1000)});
302
+                var focusComponent = Moderator.getFocusComponent();
303
+                var retrySec = waitMs / 1000;
304
+                // FIXME: message is duplicated ?
305
+                // Do not show in case of session invalid
306
+                // which means just a retry
307
+                if (!invalidSession) {
308
+                    APP.UI.messageHandler.notify(
309
+                        null, "notify.focus",
310
+                        'Conference focus', 'disconnected', "notify.focusFail",
311
+                        {component: focusComponent, ms: retrySec});
312
+                }
309 313
                 // Reset response timeout
310 314
                 getNextTimeout(true);
311 315
                 window.setTimeout(

Loading…
Annulla
Salva