mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
SCNetworkCheckReachabilityByName will be deprecated anyways, so replace it with the docs example which will work on any OS version from 10.3.
Modified-by: Nathan Kinsinger <nkinsinger@brotherbard.com> Released the target to stop memory leak.
This commit is contained in:
committed by
Nathan Kinsinger
parent
d5f9c822af
commit
fffa02425a
+8
-2
@@ -110,8 +110,14 @@
|
||||
|
||||
- (BOOL) isReachable:(NSString *)hostname
|
||||
{
|
||||
SCNetworkConnectionFlags flags;
|
||||
if (!SCNetworkCheckReachabilityByName([hostname cStringUsingEncoding:NSASCIIStringEncoding], &flags))
|
||||
SCNetworkReachabilityRef target;
|
||||
SCNetworkConnectionFlags flags = 0;
|
||||
Boolean reachable;
|
||||
target = SCNetworkReachabilityCreateWithName(NULL, [hostname cStringUsingEncoding:NSASCIIStringEncoding]);
|
||||
reachable = SCNetworkReachabilityGetFlags(target, &flags);
|
||||
CFRelease(target);
|
||||
|
||||
if (!reachable)
|
||||
return FALSE;
|
||||
|
||||
// If a connection is required, then it's not reachable
|
||||
|
||||
Reference in New Issue
Block a user