Browse Source

Merge pull request #1176 from jitsi/net_or_infra

Add 'isNetworkFailure' argument to PageReloadOverlay
master
yanas 9 years ago
parent
commit
75b3bc6190
5 changed files with 43 additions and 23 deletions
  1. 29
    14
      conference.js
  2. 3
    4
      logging_config.js
  3. 5
    2
      modules/UI/UI.js
  4. 4
    1
      modules/UI/reload_overlay/PageReloadOverlay.js
  5. 2
    2
      package.json

+ 29
- 14
conference.js View File

@@ -387,7 +387,8 @@ class ConferenceConnector {
387 387
             // the app. Both the errors above are unrecoverable from the library
388 388
             // perspective.
389 389
             room.leave().then(() => connection.disconnect());
390
-            APP.UI.showPageReloadOverlay(err);
390
+            APP.UI.showPageReloadOverlay(
391
+                false /* not a network type of failure */, err);
391 392
             break;
392 393
 
393 394
         case ConferenceErrors.CONFERENCE_MAX_USERS:
@@ -545,20 +546,34 @@ export default {
545 546
      */
546 547
     _bindConnectionFailedHandler (connection) {
547 548
         const handler = function (error, errMsg) {
548
-            if (ConnectionErrors.OTHER_ERROR === error) {
549
-                // - item-not-found
550
-                // - connection dropped(closed by Strophe unexpectedly
551
-                //   possible due too many transport errors)
552
-                logger.error("XMPP connection error: " + errMsg);
553
-                APP.UI.showPageReloadOverlay(
554
-                    "xmpp-conn-dropped:" + errMsg);
555
-                connection.removeEventListener(
556
-                    ConnectionEvents.CONNECTION_FAILED, handler);
557
-                // FIXME it feels like the conference should be stopped
558
-                // by lib-jitsi-meet
559
-                if (room)
560
-                    room.leave();
549
+            /* eslint-disable no-case-declarations */
550
+            switch (error) {
551
+                case ConnectionErrors.CONNECTION_DROPPED_ERROR:
552
+                case ConnectionErrors.OTHER_ERROR:
553
+                case ConnectionErrors.SERVER_ERROR:
554
+
555
+                    logger.error("XMPP connection error: " + errMsg);
556
+
557
+                    // From all of the cases above only CONNECTION_DROPPED_ERROR
558
+                    // is considered a network type of failure
559
+                    const isNetworkFailure
560
+                        = error === ConnectionErrors.CONNECTION_DROPPED_ERROR;
561
+
562
+                    APP.UI.showPageReloadOverlay(
563
+                        isNetworkFailure,
564
+                        "xmpp-conn-dropped:" + errMsg);
565
+
566
+                    connection.removeEventListener(
567
+                        ConnectionEvents.CONNECTION_FAILED, handler);
568
+
569
+                    // FIXME it feels like the conference should be stopped
570
+                    // by lib-jitsi-meet
571
+                    if (room)
572
+                        room.leave();
573
+
574
+                    break;
561 575
             }
576
+            /* eslint-enable no-case-declarations */
562 577
         };
563 578
         connection.addEventListener(
564 579
             ConnectionEvents.CONNECTION_FAILED, handler);

+ 3
- 4
logging_config.js View File

@@ -1,10 +1,9 @@
1 1
 // Logging configuration
2 2
 var loggingConfig = { // eslint-disable-line no-unused-vars
3 3
     //default log level for the app and lib-jitsi-meet
4
-    //defaultLogLevel: 'trace',
4
+    defaultLogLevel: 'trace',
5 5
     // Option to disable LogCollector (which stores the logs on CallStats)
6 6
     //disableLogCollector: true,
7
-    // Examples:
8
-    //'modules/version/ComponentsVersions.js': 'info',
9
-    //'modules/xmpp/ChatRoom.js': 'log'
7
+    // Logging level adjustments for verbose modules:
8
+    'modules/xmpp/strophe.util.js': 'log'
10 9
 };

+ 5
- 2
modules/UI/UI.js View File

@@ -1093,12 +1093,15 @@ UI.notifyFocusDisconnected = function (focus, retrySec) {
1093 1093
  * Notify the user that the video conferencing service is badly broken and
1094 1094
  * the page should be reloaded.
1095 1095
  *
1096
+ * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's caused by
1097
+ * network related failure or <tt>false</tt> when it's the infrastructure.
1096 1098
  * @param {string} a label string identifying the reason for the page reload
1097 1099
  * which will be included in details of the log event.
1098 1100
  */
1099
-UI.showPageReloadOverlay = function (reason) {
1101
+UI.showPageReloadOverlay = function (isNetworkFailure, reason) {
1100 1102
     // Reload the page after 10 - 30 seconds
1101
-    PageReloadOverlay.show(10 + RandomUtil.randomInt(0, 20), reason);
1103
+    PageReloadOverlay.show(
1104
+        10 + RandomUtil.randomInt(0, 20), isNetworkFailure, reason);
1102 1105
 };
1103 1106
 
1104 1107
 /**

+ 4
- 1
modules/UI/reload_overlay/PageReloadOverlay.js View File

@@ -113,10 +113,13 @@ export default {
113 113
      *
114 114
      * @param {number} timeoutSeconds how many seconds before the conference
115 115
      * reload will happen.
116
+     * @param {boolean} isNetworkFailure <tt>true</tt> indicates that it's
117
+     * caused by network related failure or <tt>false</tt> when it's
118
+     * the infrastructure.
116 119
      * @param {string} reason a label string identifying the reason for the page
117 120
      * reload which will be included in details of the log event
118 121
      */
119
-    show(timeoutSeconds, reason) {
122
+    show(timeoutSeconds, isNetworkFailure, reason) {
120 123
 
121 124
         if (!overlay) {
122 125
             overlay = new PageReloadOverlayImpl(timeoutSeconds);

+ 2
- 2
package.json View File

@@ -44,8 +44,8 @@
44 44
     "redux": "^3.5.2",
45 45
     "redux-thunk": "^2.1.0",
46 46
     "retry": "0.6.1",
47
-    "strophe": "^1.2.2",
48
-    "strophejs-plugins": "^0.0.6",
47
+    "strophe": "1.2.4",
48
+    "strophejs-plugins": "0.0.7",
49 49
     "toastr": "^2.0.3",
50 50
     "url-polyfill": "github/url-polyfill",
51 51
     "xmldom": "^0.1.27"

Loading…
Cancel
Save