Authored by Olivier Poitrey

Fix double call to NSURLConnection start + wrong condition for low priority (fix #212)

@@ -56,16 +56,15 @@ @@ -56,16 +56,15 @@
56 56
57 dispatch_async(dispatch_get_main_queue(), ^ 57 dispatch_async(dispatch_get_main_queue(), ^
58 { 58 {
59 - self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO];  
60 - [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];  
61 - [self.connection start];  
62 self.executing = YES; 59 self.executing = YES;
  60 + self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO];
63 61
64 // If not in low priority mode, ensure we aren't blocked by UI manipulations (default runloop mode for NSURLConnection is NSEventTrackingRunLoopMode) 62 // If not in low priority mode, ensure we aren't blocked by UI manipulations (default runloop mode for NSURLConnection is NSEventTrackingRunLoopMode)
65 - if (self.options & SDWebImageDownloaderLowPriority) 63 + if (!(self.options & SDWebImageDownloaderLowPriority))
66 { 64 {
67 [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; 65 [self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
68 } 66 }
  67 +
69 [self.connection start]; 68 [self.connection start];
70 69
71 if (self.connection) 70 if (self.connection)