From 2352811c2092e22ffde290b301c9d1f16772b6b1 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 1 Dec 2016 10:37:57 -0600 Subject: [PATCH 1/3] chore(package.json): use fixed version of Strophe There was functionality added to lib-jitsi-meet that depends on particular version of Strophe. It could be possibly broken without testing the update. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6508608209..dbbfcebf3f 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "redux": "^3.5.2", "redux-thunk": "^2.1.0", "retry": "0.6.1", - "strophe": "^1.2.2", - "strophejs-plugins": "^0.0.6", + "strophe": "1.2.4", + "strophejs-plugins": "0.0.7", "toastr": "^2.0.3", "url-polyfill": "github/url-polyfill", "xmldom": "^0.1.27" From 44beed6216439bb743232c3a177270f181a86511 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 1 Dec 2016 10:56:35 -0600 Subject: [PATCH 2/3] feat: distinguish between network and infra... failure --- conference.js | 9 +++++++-- logging_config.js | 7 +++---- modules/UI/UI.js | 7 +++++-- modules/UI/reload_overlay/PageReloadOverlay.js | 5 ++++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/conference.js b/conference.js index 66c83858e2..cec5450026 100644 --- a/conference.js +++ b/conference.js @@ -387,7 +387,8 @@ class ConferenceConnector { // the app. Both the errors above are unrecoverable from the library // perspective. room.leave().then(() => connection.disconnect()); - APP.UI.showPageReloadOverlay(err); + APP.UI.showPageReloadOverlay( + false /* not a network type of failure */, err); break; case ConferenceErrors.CONFERENCE_MAX_USERS: @@ -545,12 +546,16 @@ export default { */ _bindConnectionFailedHandler (connection) { const handler = function (error, errMsg) { - if (ConnectionErrors.OTHER_ERROR === error) { + if (ConnectionErrors.OTHER_ERROR === error || + ConnectionErrors.SERVER_ERROR === error) { // - item-not-found // - connection dropped(closed by Strophe unexpectedly // possible due too many transport errors) + const isNetworkFailure + = error !== ConnectionErrors.SERVER_ERROR; logger.error("XMPP connection error: " + errMsg); APP.UI.showPageReloadOverlay( + isNetworkFailure, "xmpp-conn-dropped:" + errMsg); connection.removeEventListener( ConnectionEvents.CONNECTION_FAILED, handler); diff --git a/logging_config.js b/logging_config.js index ab2ef1d766..54103c1e86 100644 --- a/logging_config.js +++ b/logging_config.js @@ -1,10 +1,9 @@ // Logging configuration var loggingConfig = { // eslint-disable-line no-unused-vars //default log level for the app and lib-jitsi-meet - //defaultLogLevel: 'trace', + defaultLogLevel: 'trace', // Option to disable LogCollector (which stores the logs on CallStats) //disableLogCollector: true, - // Examples: - //'modules/version/ComponentsVersions.js': 'info', - //'modules/xmpp/ChatRoom.js': 'log' + // Logging level adjustments for verbose modules: + 'modules/xmpp/strophe.util.js': 'log' }; \ No newline at end of file diff --git a/modules/UI/UI.js b/modules/UI/UI.js index dbd30fdd17..fe61aa21a4 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1093,12 +1093,15 @@ UI.notifyFocusDisconnected = function (focus, retrySec) { * Notify the user that the video conferencing service is badly broken and * the page should be reloaded. * + * @param {boolean} isNetworkFailure true indicates that it's caused by + * network related failure or false when it's the infrastructure. * @param {string} a label string identifying the reason for the page reload * which will be included in details of the log event. */ -UI.showPageReloadOverlay = function (reason) { +UI.showPageReloadOverlay = function (isNetworkFailure, reason) { // Reload the page after 10 - 30 seconds - PageReloadOverlay.show(10 + RandomUtil.randomInt(0, 20), reason); + PageReloadOverlay.show( + 10 + RandomUtil.randomInt(0, 20), isNetworkFailure, reason); }; /** diff --git a/modules/UI/reload_overlay/PageReloadOverlay.js b/modules/UI/reload_overlay/PageReloadOverlay.js index 856f53f657..7a1d1db37d 100644 --- a/modules/UI/reload_overlay/PageReloadOverlay.js +++ b/modules/UI/reload_overlay/PageReloadOverlay.js @@ -113,10 +113,13 @@ export default { * * @param {number} timeoutSeconds how many seconds before the conference * reload will happen. + * @param {boolean} isNetworkFailure true indicates that it's + * caused by network related failure or false when it's + * the infrastructure. * @param {string} reason a label string identifying the reason for the page * reload which will be included in details of the log event */ - show(timeoutSeconds, reason) { + show(timeoutSeconds, isNetworkFailure, reason) { if (!overlay) { overlay = new PageReloadOverlayImpl(timeoutSeconds); From 6c716bcbb1d6da5dcd8c035862c777e5820cb9cc Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 1 Dec 2016 15:50:37 -0600 Subject: [PATCH 3/3] fix(conference.js): handle CONNECTION_DROPPED_ERROR --- conference.js | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/conference.js b/conference.js index cec5450026..f9e579dcbf 100644 --- a/conference.js +++ b/conference.js @@ -546,24 +546,34 @@ export default { */ _bindConnectionFailedHandler (connection) { const handler = function (error, errMsg) { - if (ConnectionErrors.OTHER_ERROR === error || - ConnectionErrors.SERVER_ERROR === error) { - // - item-not-found - // - connection dropped(closed by Strophe unexpectedly - // possible due too many transport errors) - const isNetworkFailure - = error !== ConnectionErrors.SERVER_ERROR; - logger.error("XMPP connection error: " + errMsg); - APP.UI.showPageReloadOverlay( - isNetworkFailure, - "xmpp-conn-dropped:" + errMsg); - connection.removeEventListener( - ConnectionEvents.CONNECTION_FAILED, handler); - // FIXME it feels like the conference should be stopped - // by lib-jitsi-meet - if (room) - room.leave(); + /* eslint-disable no-case-declarations */ + switch (error) { + case ConnectionErrors.CONNECTION_DROPPED_ERROR: + case ConnectionErrors.OTHER_ERROR: + case ConnectionErrors.SERVER_ERROR: + + logger.error("XMPP connection error: " + errMsg); + + // From all of the cases above only CONNECTION_DROPPED_ERROR + // is considered a network type of failure + const isNetworkFailure + = error === ConnectionErrors.CONNECTION_DROPPED_ERROR; + + APP.UI.showPageReloadOverlay( + isNetworkFailure, + "xmpp-conn-dropped:" + errMsg); + + connection.removeEventListener( + ConnectionEvents.CONNECTION_FAILED, handler); + + // FIXME it feels like the conference should be stopped + // by lib-jitsi-meet + if (room) + room.leave(); + + break; } + /* eslint-enable no-case-declarations */ }; connection.addEventListener( ConnectionEvents.CONNECTION_FAILED, handler);