You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (self.completedBlock) {
self.completedBlock(nil, nil, error, YES);
}
.....
this two functions are the delegate callback for NSURLConnection normally.
but in sdwebimage, it only do some special operations in connectionDidFinishLoading.
i think this code is used to race conditions with cancel operation. is it true?
If so, why this code only write in connectionDidFinishLoading, what about the function - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error ?
i hope you could tell me the reason. thanks very much!
The text was updated successfully, but these errors were encountered:
i see the code like this
1:
SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock;
@synchronized(self) {
CFRunLoopStop(CFRunLoopGetCurrent());
self.thread = nil;
self.connection = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
}
......
2:
(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
CFRunLoopStop(CFRunLoopGetCurrent());
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
if (self.completedBlock) {
self.completedBlock(nil, nil, error, YES);
}
.....
this two functions are the delegate callback for NSURLConnection normally.
but in sdwebimage, it only do some special operations in connectionDidFinishLoading.
@synchronized(self) {
CFRunLoopStop(CFRunLoopGetCurrent());
self.thread = nil;
self.connection = nil;
[[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:nil];
}
i think this code is used to race conditions with cancel operation. is it true?
If so, why this code only write in connectionDidFinishLoading, what about the function - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error ?
i hope you could tell me the reason. thanks very much!
The text was updated successfully, but these errors were encountered: