Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Retry to download checksums file if the first attempt yields a connec…

…tion error (not an HTTP error code)
  • Loading branch information...
commit b1e254364316389d866c648f8c6f1cef4e6beb1e 1 parent 92333bf
@richard richard authored
Showing with 20 additions and 1 deletion.
  1. +1 −0  Classes/Sync/SyncManager.h
  2. +19 −1 Classes/Sync/SyncManager.m
View
1  Classes/Sync/SyncManager.h
@@ -33,6 +33,7 @@ typedef enum {
SyncManagerTransferStateUploadingEmptyEditsFile,
SyncManagerTransferStateUploadingLocalChanges,
SyncManagerTransferStateDownloadingChecksums,
+ SyncManagerTransferStateRetryDownloadingChecksums,
SyncManagerTransferStateDownloadingOrgFiles,
} SyncManagerTransferState;
View
20 Classes/Sync/SyncManager.m
@@ -688,6 +688,7 @@ - (void)transferComplete:(TransferContext*)context {
break;
case SyncManagerTransferStateDownloadingChecksums:
+ case SyncManagerTransferStateRetryDownloadingChecksums:
[self processChecksumFile:[context localFile]];
break;
@@ -757,7 +758,24 @@ - (void)transferFailed:(TransferContext*)context {
case SyncManagerTransferStateDownloadingChecksums:
if ([context statusCode] >= 400 && [context statusCode] < 600) {
- // Fetch the Org files, just assume they don't have a checksum file
+ // Fetch the Org files, just assume they don't have a checksum file since the server
+ // gave us an error code answer
+ [self downloadOrgFiles];
+ } else {
+ // If the error code wasn't a 4 or 600, there was likely some connectivity issue
+ // preventing us from downloading the file. Some users reported that simply giving
+ // it another go is good enough, so we'll retry here to see if it helps.
+ DeleteFile([context localFile]);
+ currentState = SyncManagerTransferStateRetryDownloadingChecksums;
+ [self downloadChecksumFile];
+ }
+ break;
+
+ case SyncManagerTransferStateRetryDownloadingChecksums:
+
+ if ([context statusCode] >= 400 && [context statusCode] < 600) {
+ // Fetch the Org files, just assume they don't have a checksum file since the server
+ // gave us an error code answer
[self downloadOrgFiles];
} else {
DeleteFile([context localFile]);
Please sign in to comment.
Something went wrong with that request. Please try again.