fix(conference.js): handle CONNECTION_DROPPED_ERROR

This commit is contained in:
paweldomas 2016-12-01 15:50:37 -06:00
parent 44beed6216
commit 6c716bcbb1
1 changed files with 27 additions and 17 deletions

View File

@ -546,24 +546,34 @@ export default {
*/ */
_bindConnectionFailedHandler (connection) { _bindConnectionFailedHandler (connection) {
const handler = function (error, errMsg) { const handler = function (error, errMsg) {
if (ConnectionErrors.OTHER_ERROR === error || /* eslint-disable no-case-declarations */
ConnectionErrors.SERVER_ERROR === error) { switch (error) {
// - item-not-found case ConnectionErrors.CONNECTION_DROPPED_ERROR:
// - connection dropped(closed by Strophe unexpectedly case ConnectionErrors.OTHER_ERROR:
// possible due too many transport errors) case ConnectionErrors.SERVER_ERROR:
const isNetworkFailure
= error !== ConnectionErrors.SERVER_ERROR; logger.error("XMPP connection error: " + errMsg);
logger.error("XMPP connection error: " + errMsg);
APP.UI.showPageReloadOverlay( // From all of the cases above only CONNECTION_DROPPED_ERROR
isNetworkFailure, // is considered a network type of failure
"xmpp-conn-dropped:" + errMsg); const isNetworkFailure
connection.removeEventListener( = error === ConnectionErrors.CONNECTION_DROPPED_ERROR;
ConnectionEvents.CONNECTION_FAILED, handler);
// FIXME it feels like the conference should be stopped APP.UI.showPageReloadOverlay(
// by lib-jitsi-meet isNetworkFailure,
if (room) "xmpp-conn-dropped:" + errMsg);
room.leave();
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( connection.addEventListener(
ConnectionEvents.CONNECTION_FAILED, handler); ConnectionEvents.CONNECTION_FAILED, handler);