Skip to content

Commit

Permalink
[Issue #970] Refactoring network reachability to be more conventional…
Browse files Browse the repository at this point in the history
… (/thanks @djmadcat)
  • Loading branch information
mattt committed May 8, 2013
1 parent fa0c8b8 commit c3db232
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions AFNetworking/AFHTTPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused targ
}

static const void * AFNetworkReachabilityRetainCallback(const void *info) {
return (__bridge_retained const void *)([(__bridge AFNetworkReachabilityStatusBlock)info copy]);
return Block_copy(info);
}

static void AFNetworkReachabilityReleaseCallback(const void *info) {
if (info) {
CFRelease(info);
Block_release(info);
}
}

Expand Down Expand Up @@ -382,8 +382,9 @@ - (void)startMonitoringNetworkReachability {
}

- (void)stopMonitoringNetworkReachability {
if (_networkReachability) {
SCNetworkReachabilityUnscheduleFromRunLoop(_networkReachability, CFRunLoopGetMain(), (CFStringRef)NSRunLoopCommonModes);
if (self.networkReachability) {
SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), (CFStringRef)NSRunLoopCommonModes);

CFRelease(_networkReachability);
_networkReachability = NULL;
}
Expand Down

0 comments on commit c3db232

Please sign in to comment.