Revision d8426ffb pithos-macos/PithosContainerNode.m

b/pithos-macos/PithosContainerNode.m
106 106
#pragma mark -
107 107
#pragma mark Properties
108 108

  
109
- (void)setPithos:(ASIPithos *)aPithos {
110
    if (aPithos && ![aPithos isEqualTo:pithos]) {
111
        [pithos release];
112
        pithos = [aPithos retain];
113
        [url release];
114
        url = nil;
115
    }
116
}
117

  
109 118
- (NSString *)url {
110 119
    if (url == nil)
111 120
        url = [[NSString alloc] initWithFormat:@"%@/%@%@", 
......
413 422

  
414 423
- (void)containerMetadataRequestFailed:(ASIPithosContainerRequest *)request {
415 424
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
416
    if ([request isEqualTo:applyMetadataContainerRequest]) {
417
        [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataContainerRequest];
418
        @synchronized(self) {
419
            [applyMetadataContainerRequest release];
420
            applyMetadataContainerRequest = nil;
425
    NSUInteger retries = [[request.userInfo objectForKey:@"retries"] unsignedIntegerValue];
426
    if (retries > 0) {
427
        ASIPithosContainerRequest *newRequest = (ASIPithosContainerRequest *)[PithosUtilities copyRequest:request];
428
        [(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
429
        if ([request isEqualTo:applyMetadataContainerRequest]) {
430
            @synchronized(self) {
431
                [applyMetadataContainerRequest release];
432
                applyMetadataContainerRequest = newRequest;
433
            }
434
        } else if ([request isEqualTo:refreshMetadataContainerRequest]) {
435
            @synchronized(self) {
436
                [refreshMetadataContainerRequest release];
437
                refreshMetadataContainerRequest = newRequest;
438
            }
421 439
        }
422
    } else if ([request isEqualTo:refreshMetadataContainerRequest]) {
423
        [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataContainerRequest];
424
        @synchronized(self) {
425
            [refreshMetadataContainerRequest release];
426
            refreshMetadataContainerRequest = nil;
440
        [[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]] startAsynchronous];
441
    } else {
442
        if ([request isEqualTo:applyMetadataContainerRequest]) {
443
            dispatch_async(dispatch_get_main_queue(), ^{
444
                [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataContainerRequest];
445
            });
446
            @synchronized(self) {
447
                [applyMetadataContainerRequest release];
448
                applyMetadataContainerRequest = nil;
449
            }
450
        } else if ([request isEqualTo:refreshMetadataContainerRequest]) {
451
            dispatch_async(dispatch_get_main_queue(), ^{
452
                [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataContainerRequest];
453
            });
454
            @synchronized(self) {
455
                [refreshMetadataContainerRequest release];
456
                refreshMetadataContainerRequest = nil;
457
            }
427 458
        }
428 459
    }
429 460
    [pool drain];

Also available in: Unified diff