409 |
409 |
}
|
410 |
410 |
|
411 |
411 |
- (void)setPithos:(ASIPithos *)aPithos {
|
412 |
|
if (!pithos) {
|
|
412 |
if (!aPithos) {
|
|
413 |
return;
|
|
414 |
} else if (!pithos) {
|
413 |
415 |
pithos = [ASIPithos pithos];
|
414 |
|
pithos.authToken = [aPithos.authToken copy];
|
415 |
|
pithos.authUser = [aPithos.authUser copy];
|
416 |
|
pithos.ignoreSSLErrors = aPithos.ignoreSSLErrors;
|
417 |
|
pithos.tokensURL = [aPithos.tokensURL copy];
|
418 |
|
pithos.storageURLPrefix = [aPithos.storageURLPrefix copy];
|
419 |
|
pithos.publicURLPrefix = [aPithos.publicURLPrefix copy];
|
420 |
|
pithos.userCatalogURL = [aPithos.userCatalogURL copy];
|
421 |
|
}
|
422 |
|
if (aPithos &&
|
423 |
|
(![aPithos.authUser isEqualToString:pithos.authUser] ||
|
424 |
|
![aPithos.authToken isEqualToString:pithos.authToken] ||
|
425 |
|
![aPithos.storageURLPrefix isEqual:pithos.storageURLPrefix])) {
|
|
416 |
} else if (![aPithos.tokensURL isEqualToString:pithos.tokensURL] || ![aPithos.authUser isEqualToString:pithos.authUser]) {
|
|
417 |
// If the authURL or the authUser actually changed, reset daemon and local state.
|
426 |
418 |
[self resetDaemon];
|
427 |
|
if (![aPithos.authUser isEqualToString:pithos.authUser] ||
|
428 |
|
![aPithos.storageURLPrefix isEqual:pithos.storageURLPrefix])
|
429 |
|
[self resetLocalStateWithAll:YES];
|
430 |
|
pithos.authToken = [aPithos.authToken copy];
|
431 |
|
pithos.authUser = [aPithos.authUser copy];
|
432 |
|
pithos.ignoreSSLErrors = aPithos.ignoreSSLErrors;
|
433 |
|
pithos.tokensURL = [aPithos.tokensURL copy];
|
434 |
|
pithos.storageURLPrefix = [aPithos.storageURLPrefix copy];
|
435 |
|
pithos.publicURLPrefix = [aPithos.publicURLPrefix copy];
|
436 |
|
pithos.userCatalogURL = [aPithos.userCatalogURL copy];
|
|
419 |
[self resetLocalStateWithAll:YES];
|
437 |
420 |
}
|
|
421 |
pithos.authToken = [aPithos.authToken copy];
|
|
422 |
pithos.authUser = [aPithos.authUser copy];
|
|
423 |
pithos.ignoreSSLErrors = aPithos.ignoreSSLErrors;
|
|
424 |
pithos.tokensURL = [aPithos.tokensURL copy];
|
|
425 |
pithos.storageURLPrefix = [aPithos.storageURLPrefix copy];
|
|
426 |
pithos.publicURLPrefix = [aPithos.publicURLPrefix copy];
|
|
427 |
pithos.userCatalogURL = [aPithos.userCatalogURL copy];
|
438 |
428 |
}
|
439 |
429 |
|
440 |
430 |
#pragma mark -
|
... | ... | |
1880 |
1870 |
// If the server listing fails, the sync should start over, so just retrying is enough
|
1881 |
1871 |
NSUInteger retries = [[containerRequest.userInfo objectForKey:@"retries"] unsignedIntegerValue];
|
1882 |
1872 |
if (retries > 0) {
|
1883 |
|
ASIPithosContainerRequest *newContainerRequest = (ASIPithosContainerRequest *)[PithosUtilities copyRequest:containerRequest];
|
|
1873 |
ASIPithosContainerRequest *newContainerRequest = (ASIPithosContainerRequest *)[PithosUtilities retryWithUpdatedURLRequest:containerRequest
|
|
1874 |
andPithosAccountManager:pithosAccount];
|
1884 |
1875 |
[(NSMutableDictionary *)(newContainerRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
|
1885 |
1876 |
[networkQueue addOperation:[PithosUtilities prepareRequest:newContainerRequest priority:[[newContainerRequest.userInfo objectForKey:@"priority"] integerValue]]];
|
1886 |
1877 |
} else {
|
... | ... | |
2380 |
2371 |
}
|
2381 |
2372 |
NSUInteger retries = [[request.userInfo objectForKey:@"retries"] unsignedIntegerValue];
|
2382 |
2373 |
if (retries > 0) {
|
2383 |
|
ASIPithosRequest *newRequest = (ASIPithosRequest *)[PithosUtilities copyRequest:request];
|
|
2374 |
ASIPithosRequest *newRequest = (ASIPithosRequest *)[PithosUtilities retryWithUpdatedURLRequest:request
|
|
2375 |
andPithosAccountManager:pithosAccount];
|
2384 |
2376 |
[(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
|
2385 |
2377 |
[networkQueue addOperation:[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]]];
|
2386 |
2378 |
} else {
|