Revision d8426ffb pithos-macos/PithosObjectNode.m

b/pithos-macos/PithosObjectNode.m
78 78
#pragma mark -
79 79
#pragma mark Properties
80 80

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

  
81 90
- (NSString *)url {
82 91
    if (url == nil)
83 92
        url = [[NSString alloc] initWithFormat:@"object %@/%@/%@%@", 
......
153 162

  
154 163
- (void)objectRequestFailed:(ASIPithosObjectRequest *)request {
155 164
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
156
    if ([request isEqualTo:applyMetadataObjectRequest]) {
157
        [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataObjectRequest];
158
        @synchronized(self) {
159
            [applyMetadataObjectRequest release];
160
            applyMetadataObjectRequest = nil;
165
    NSUInteger retries = [[request.userInfo objectForKey:@"retries"] unsignedIntegerValue];
166
    if (retries > 0) {
167
        ASIPithosObjectRequest *newRequest = (ASIPithosObjectRequest *)[PithosUtilities copyRequest:request];
168
        [(NSMutableDictionary *)(newRequest.userInfo)setObject:[NSNumber numberWithUnsignedInteger:(--retries)] forKey:@"retries"];
169
        if ([request isEqualTo:applyMetadataObjectRequest]) {
170
            @synchronized(self) {
171
                [applyMetadataObjectRequest release];
172
                applyMetadataObjectRequest = newRequest;
173
            }
174
        } else if ([request isEqualTo:refreshMetadataObjectRequest]) {
175
            @synchronized(self) {
176
                [refreshMetadataObjectRequest release];
177
                refreshMetadataObjectRequest = newRequest;
178
            }
161 179
        }
162
    } else if ([request isEqualTo:refreshMetadataObjectRequest]) {
163
        [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataObjectRequest];
164
        @synchronized(self) {
165
            [refreshMetadataObjectRequest release];
166
            refreshMetadataObjectRequest = nil;
180
        [[PithosUtilities prepareRequest:newRequest priority:[[newRequest.userInfo objectForKey:@"priority"] integerValue]] startAsynchronous];
181
    } else {
182
        if ([request isEqualTo:applyMetadataObjectRequest]) {
183
            dispatch_async(dispatch_get_main_queue(), ^{
184
                [PithosUtilities httpRequestErrorAlertWithRequest:applyMetadataObjectRequest];
185
            });
186
            @synchronized(self) {
187
                [applyMetadataObjectRequest release];
188
                applyMetadataObjectRequest = nil;
189
            }
190
        } else if ([request isEqualTo:refreshMetadataObjectRequest]) {
191
            dispatch_async(dispatch_get_main_queue(), ^{
192
                [PithosUtilities httpRequestErrorAlertWithRequest:refreshMetadataObjectRequest];
193
            });
194
            @synchronized(self) {
195
                [refreshMetadataObjectRequest release];
196
                refreshMetadataObjectRequest = nil;
197
            }
167 198
        }
168 199
    }
169 200
    [pool drain];

Also available in: Unified diff