Create new upload session on reinit (Issue: #379) (#392)

* By moving the UploadSession creation from the constructor to the init function we guarantee that a re-initialization also starts a new UploadSession.
This commit is contained in:
Norbert Preining 2019-02-27 04:49:23 +09:00 committed by abraunegg
parent 97193107ee
commit b668ecef71
2 changed files with 4 additions and 2 deletions

View file

@ -577,7 +577,7 @@ int main(string[] args)
// we already tried three times in the performSync routine
// if we still have problems, then the sync handle might have
// gone stale and we need to re-initialize the sync engine
log.log("Pesistent connection errors, reinitializing connection");
log.log("Persistent connection errors, reinitializing connection");
sync.reset();
}
} catch (CurlException e) {

View file

@ -208,7 +208,7 @@ final class SyncEngine
this.onedrive = onedrive;
this.itemdb = itemdb;
this.selectiveSync = selectiveSync;
session = UploadSession(onedrive, cfg.uploadStateFilePath);
// session = UploadSession(onedrive, cfg.uploadStateFilePath);
}
void reset()
@ -226,6 +226,8 @@ final class SyncEngine
return;
}
session = UploadSession(onedrive, cfg.uploadStateFilePath);
// Need to catch 400 or 5xx server side errors at initialization
try {
oneDriveDetails = onedrive.getDefaultDrive();