Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
[santactl] Ensure reachability is released properly
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox committed Oct 26, 2017
1 parent b4fa2a3 commit 57213ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/santactl/Commands/sync/SNTCommandSyncManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ - (instancetype)initWithDaemonConnection:(SNTXPCConnection *)daemonConn isDaemon
return self;
}

- (void)dealloc {
// Ensure reachability is always stopped
[self stopReachability];
}

#pragma mark SNTSyncdXPC protocol methods

- (void)postEventsToSyncServer:(NSArray<SNTStoredEvent *> *)events isFromBundle:(BOOL)isFromBundle {
Expand Down Expand Up @@ -521,7 +526,8 @@ - (void)startReachability {
const char *nodename = [[SNTConfigurator configurator] syncBaseURL].host.UTF8String;
_reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, nodename);
SCNetworkReachabilityContext context = {
.info = (__bridge void *)self
.info = (__bridge_retained void *)self,
.release = (void (*)(const void *))CFBridgingRelease,
};
if (SCNetworkReachabilitySetCallback(_reachability, reachabilityHandler, &context)) {
SCNetworkReachabilitySetDispatchQueue(_reachability,
Expand Down

0 comments on commit 57213ee

Please sign in to comment.