Revision d8426ffb pithos-macos/PithosAccountNode.m

b/pithos-macos/PithosAccountNode.m
81 81
#pragma mark -
82 82
#pragma mark Properties
83 83

  
84
- (void)setPithos:(ASIPithos *)aPithos {
85
    if (aPithos && ![aPithos isEqualTo:pithos]) {
86
        [pithos release];
87
        pithos = [aPithos retain];
88
        [url release];
89
        url = nil;
90
    }
91
}
92

  
84 93
- (NSString *)url {
85 94
    if (url == nil)
86 95
        url = [[NSString alloc] initWithFormat:@"%@%@", 
......
298 307

  
299 308
- (void)accountMetadataRequestFailed:(ASIPithosAccountRequest *)request {
300 309
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
301
    if ([request isEqualTo:applyMetadataAccountRequest]) {
302
        [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataAccountRequest];
303
        @synchronized(self) {
304
            [applyMetadataAccountRequest release];
305
            applyMetadataAccountRequest = nil;
310
    NSUInteger retries = [[request.userInfo objectForKey:@"retries"] unsignedIntegerValue];
311
    if (retries > 0) {
312
        ASIPithosAccountRequest *newRequest = (ASIPithosAccountRequest *)[PithosUtilities copyRequest:request];
313
        [(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
314
        if ([request isEqualTo:applyMetadataAccountRequest]) {
315
            @synchronized(self) {
316
                [applyMetadataAccountRequest release];
317
                applyMetadataAccountRequest = newRequest;
318
            }
319
        } else if ([request isEqualTo:refreshMetadataAccountRequest]) {
320
            @synchronized(self) {
321
                [refreshMetadataAccountRequest release];
322
                refreshMetadataAccountRequest = newRequest;
323
            }
306 324
        }
307
    } else if ([request isEqualTo:refreshMetadataAccountRequest]) {
308
        [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataAccountRequest];
309
        @synchronized(self) {
310
            [refreshMetadataAccountRequest release];
311
            refreshMetadataAccountRequest = nil;
325
        [[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]] startAsynchronous];
326
    } else {
327
        if ([request isEqualTo:applyMetadataAccountRequest]) {
328
            dispatch_async(dispatch_get_main_queue(), ^{
329
                [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataAccountRequest];
330
            });
331
            @synchronized(self) {
332
                [applyMetadataAccountRequest release];
333
                applyMetadataAccountRequest = nil;
334
            }
335
        } else if ([request isEqualTo:refreshMetadataAccountRequest]) {
336
            dispatch_async(dispatch_get_main_queue(), ^{
337
                [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataAccountRequest];
338
            });
339
            @synchronized(self) {
340
                [refreshMetadataAccountRequest release];
341
                refreshMetadataAccountRequest = nil;
342
            }
312 343
        }
313 344
    }
314 345
    [pool drain];

Also available in: Unified diff