Merge pull request #7115 from vector-im/andy/mandatory_crypto

Do not retry initial sync on fatal errors
This commit is contained in:
Anderas
2022-12-05 17:48:42 +00:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
@@ -890,6 +890,9 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
MXStrongifyAndReturnIfNil(self);
self->mxSession = nil;
NSString *myUserId = self.mxSession.myUser.userId;
[[NSNotificationCenter defaultCenter] postNotificationName:kMXKErrorNotification object:error userInfo:myUserId ? @{kMXKErrorUserIdKey: myUserId} : nil];
[[NSNotificationCenter defaultCenter] removeObserver:self->sessionStateObserver];
self->sessionStateObserver = nil;
@@ -1677,6 +1680,14 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
NSString *myUserId = self.mxSession.myUser.userId;
[[NSNotificationCenter defaultCenter] postNotificationName:kMXKErrorNotification object:error userInfo:myUserId ? @{kMXKErrorUserIdKey: myUserId} : nil];
}
// If we cannot resolve this error by retrying, exit early
BOOL isRetryableError = [error.domain isEqualToString:NSURLErrorDomain] || [MXHTTPOperation urlResponseFromError:error] != nil;
if (!isRetryableError)
{
MXLogDebug(@"[MXKAccount] Initial sync will not be retried");
return;
}
// Check if it is a network connectivity issue
AFNetworkReachabilityManager *networkReachabilityManager = [AFNetworkReachabilityManager sharedManager];