forked from mirrors/linphone-iphone
change reachability target to remove dependency on linphone.org
This commit is contained in:
parent
c007dd9f4b
commit
ae6d519a33
1 changed files with 11 additions and 3 deletions
|
|
@ -690,7 +690,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
|
||||
- (void)setupNetworkReachabilityCallback {
|
||||
SCNetworkReachabilityContext *ctx=NULL;
|
||||
const char *nodeName="linphone.org";
|
||||
//any internet cnx
|
||||
struct sockaddr_in zeroAddress;
|
||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||
zeroAddress.sin_family = AF_INET;
|
||||
|
||||
if (proxyReachability) {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Cancelling old network reachability"];
|
||||
|
|
@ -699,8 +703,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
proxyReachability = nil;
|
||||
}
|
||||
|
||||
proxyReachability = SCNetworkReachabilityCreateWithName(nil, nodeName);
|
||||
|
||||
proxyReachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)&zeroAddress);
|
||||
|
||||
if (!SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack, ctx)){
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Cannot register reachability cb: %s", SCErrorString(SCError())];
|
||||
|
|
@ -710,6 +713,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
[LinphoneLogger logc:LinphoneLoggerError format:"Cannot register schedule reachability cb: %s", SCErrorString(SCError())];
|
||||
return;
|
||||
}
|
||||
// this check is to know network connectivity right now without waiting for a change. Don'nt remove it unless you have good reason. Jehan
|
||||
SCNetworkReachabilityFlags flags;
|
||||
if (SCNetworkReachabilityGetFlags(proxyReachability, &flags)) {
|
||||
networkReachabilityCallBack(proxyReachability,flags,nil);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue