Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions react/features/authentication/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,6 @@ MiddlewareRegistry.register(store => next => action => {
store.dispatch(hideLoginDialog());
break;

case CONNECTION_FAILED: {
const { error } = action;
const { getState } = store;
const state = getState();
const { jwt } = state['features/base/jwt'];

if (error
&& error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
&& typeof error.recoverable === 'undefined'
&& !jwt) {
error.recoverable = true;

_handleLogin(store);
}

break;
}

case LOGIN: {
_handleLogin(store);

Expand Down
99 changes: 24 additions & 75 deletions react/features/base/conference/middleware.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,84 +443,33 @@ function _logJwtErrors(message: string, errors: string) {
* @returns {Object} The value returned by {@code next(action)}.
*/
function _connectionFailed({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
const { connection, error } = action;
const { jwt } = getState()['features/base/jwt'];

if (jwt) {
const errors: string = validateJwt(jwt).map((err: any) =>
i18n.t(`dialog.tokenAuthFailedReason.${err.key}`, err.args))
.join(' ');

_logJwtErrors(error.message, errors);

// do not show the notification when we will prompt the user
// for username and password
if (error.name === JitsiConnectionErrors.PASSWORD_REQUIRED) {
dispatch(showErrorNotification({
descriptionKey: errors ? 'dialog.tokenAuthFailedWithReasons' : 'dialog.tokenAuthFailed',
descriptionArguments: { reason: errors },
titleKey: 'dialog.tokenAuthFailedTitle'
}));
}
}

if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) {
let notificationAction: Function = showNotification;
const notificationProps = {
customActionNameKey: [ 'dialog.rejoinNow' ],
customActionHandler: [ () => dispatch(reloadNow()) ],
descriptionKey: 'notify.connectionFailed'
} as INotificationProps;

const { locationURL = { href: '' } as URL } = getState()['features/base/connection'];
const { tenant = '' } = parseURIString(locationURL.href) || {};

if (tenant.startsWith('-') || tenant.endsWith('-')) {
notificationProps.descriptionKey = 'notify.invalidTenantHyphenDescription';
notificationProps.titleKey = 'notify.invalidTenant';
notificationAction = showErrorNotification;
} else if (tenant.length > 63) {
notificationProps.descriptionKey = 'notify.invalidTenantLengthDescription';
notificationProps.titleKey = 'notify.invalidTenant';
notificationAction = showErrorNotification;
}

dispatch(notificationAction(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
}

const result = next(action);

_removeUnloadHandler(getState);

forEachConference(getState, conference => {
// TODO: revisit this
// It feels that it would make things easier if JitsiConference
// in lib-jitsi-meet would monitor it's connection and emit
// CONFERENCE_FAILED when it's dropped. It has more knowledge on
// whether it can recover or not. But because the reload screen
// and the retry logic is implemented in the app maybe it can be
// left this way for now.
if (conference.getConnection() === connection) {
// XXX Note that on mobile the error type passed to
// connectionFailed is always an object with .name property.
// This fact needs to be checked prior to enabling this logic on
// web.
const conferenceAction = conferenceFailed(conference, error.name);

// Copy the recoverable flag if set on the CONNECTION_FAILED
// action to not emit recoverable action caused by
// a non-recoverable one.
if (typeof error.recoverable !== 'undefined') {
conferenceAction.error.recoverable = error.recoverable;

console.log("[AUTO_RECONNECT] entered _connectionFailed middleware");
const { connection } = action;
const state = getState();
const conference = state['features/base/conference'].conference;
(async () => {
try {
if (conference) {
console.log("[AUTO_RECONNECT] Leaving conference");
dispatch(conferenceWillLeave(conference));
await conference.leave();
}

if (connection) {
console.log("[AUTO_RECONNECT] Disconnecting connection");
await connection.disconnect();
}

dispatch(conferenceAction);
next(action);
console.log("[AUTO_RECONNECT] Start new connection");
return dispatch(connect());

} catch (err) {
console.error("[AUTO_RECONNECT] _connectionFailed failed:", err);

}

return true;
});

return result;
})();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IStore } from '../../../../../app/types';
import { isLeavingConferenceManually } from "../../../general/utils/conferenceState";
import { isAutoReconnecting } from "../middleware.auto-reconnect";
import { showConnectionFailedNotification, showConnectionLostNotification } from "./notification-helpers";

/**
Expand All @@ -22,7 +21,6 @@ export const handleXMPPDisconnected = (dispatch: IStore["dispatch"], message: st
console.log("[CONNECTION_NOTIFICATIONS] XMPP disconnected:", message);

if (isLeavingConferenceManually()) return;
if (isAutoReconnecting()) return;

showConnectionLostNotification(dispatch);
};
Expand All @@ -37,7 +35,6 @@ export const handleXMPPDisconnected = (dispatch: IStore["dispatch"], message: st
*/
export const handleXMPPConnectionFailed = (dispatch: IStore["dispatch"], error: any, message: string) => {
console.error("[CONNECTION_NOTIFICATIONS] XMPP connection failed:", error, message);
if (isAutoReconnecting()) return;

showConnectionFailedNotification(dispatch, message);
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import './connection-notifications';
import './middleware.datachannel';
import './middleware.error-handling';
import './middleware.poor-connection';
import './middleware.auto-reconnect';

export { };

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const VideoParticipant = ({
)}
key={`video-${id}`}
// Set to false due to decoding issues and video lag
encodeVideo={true}
encodeVideo={false}
/>
) : (
<div className="w-full h-full flex items-center justify-center bg-gray-800">
Expand Down
Loading