...
|
...
|
@@ -83,7 +83,10 @@ |
|
|
return operation;
|
|
|
}
|
|
|
|
|
|
@synchronized(self.runningOperations)
|
|
|
{
|
|
|
[self.runningOperations addObject:operation];
|
|
|
}
|
|
|
NSString *key = [self cacheKeyForURL:url];
|
|
|
|
|
|
[self.imageCache queryDiskCacheForKey:key done:^(UIImage *image, SDImageCacheType cacheType)
|
...
|
...
|
@@ -93,8 +96,11 @@ |
|
|
if (image)
|
|
|
{
|
|
|
completedBlock(image, nil, cacheType, YES);
|
|
|
@synchronized(self.runningOperations)
|
|
|
{
|
|
|
[self.runningOperations removeObject:operation];
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SDWebImageDownloaderOptions downloaderOptions = 0;
|
...
|
...
|
@@ -108,9 +114,12 @@ |
|
|
{
|
|
|
if (error.code != NSURLErrorNotConnectedToInternet)
|
|
|
{
|
|
|
@synchronized(self.failedURLs)
|
|
|
{
|
|
|
[self.failedURLs addObject:url];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (downloadedImage && finished)
|
|
|
{
|
|
|
const BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
|
...
|
...
|
@@ -119,8 +128,11 @@ |
|
|
|
|
|
if (finished)
|
|
|
{
|
|
|
@synchronized(self.runningOperations)
|
|
|
{
|
|
|
[self.runningOperations removeObject:operation];
|
|
|
}
|
|
|
}
|
|
|
}];
|
|
|
operation.cancelBlock = ^{[subOperation cancel];};
|
|
|
}
|
...
|
...
|
@@ -131,8 +143,11 @@ |
|
|
|
|
|
- (void)cancelAll
|
|
|
{
|
|
|
@synchronized(self.runningOperations)
|
|
|
{
|
|
|
[self.runningOperations makeObjectsPerformSelector:@selector(cancel)];
|
|
|
[self.runningOperations removeAllObjects];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (BOOL)isRunning
|
...
|
...
|
|