mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 06:38:08 +00:00
try to workaround iOS reachability bug
This commit is contained in:
parent
1d9c0c7859
commit
5c902c829b
2 changed files with 17 additions and 7 deletions
|
|
@ -91,7 +91,7 @@ typedef struct _LinphoneCallAppData {
|
|||
-(UIImage*) getImageFromAddressBook:(NSString*) number;
|
||||
|
||||
-(BOOL) reconfigureLinphoneIfNeeded:(NSDictionary *)oldSettings;
|
||||
-(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx;
|
||||
-(void) setupNetworkReachabilityCallback;
|
||||
-(void) refreshRegisters;
|
||||
|
||||
@property (nonatomic, retain) id<LinphoneUICallDelegate> callDelegate;
|
||||
|
|
|
|||
|
|
@ -865,9 +865,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
linphone_core_iterate(theLinphoneCore);
|
||||
}
|
||||
|
||||
-(void) setupNetworkReachabilityCallback: (const char*) nodeName withContext:(SCNetworkReachabilityContext*) ctx {
|
||||
-(void) setupNetworkReachabilityCallback {
|
||||
SCNetworkReachabilityContext *ctx=NULL;
|
||||
const char *nodeName="linphone.org";
|
||||
|
||||
if (proxyReachability) {
|
||||
ms_message("Cancel old network reachability check");
|
||||
ms_message("Cancelling old network reachability");
|
||||
SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
CFRelease(proxyReachability);
|
||||
proxyReachability = nil;
|
||||
|
|
@ -943,7 +946,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
|
||||
linphone_core_set_zrtp_secrets_file(theLinphoneCore, [zrtpSecretsFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
|
||||
[self setupNetworkReachabilityCallback: "linphone.org" withContext:nil];
|
||||
[self setupNetworkReachabilityCallback];
|
||||
|
||||
[self reconfigureLinphoneIfNeeded:nil];
|
||||
|
||||
|
|
@ -1014,9 +1017,16 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
|
|||
if (proxyReachability){
|
||||
SCNetworkReachabilityFlags flags=0;
|
||||
if (!SCNetworkReachabilityGetFlags(proxyReachability, &flags)) {
|
||||
ms_error("Cannot get reachability flags");
|
||||
}else
|
||||
networkReachabilityCallBack(proxyReachability, flags, 0);
|
||||
ms_error("Cannot get reachability flags, re-creating reachability context.");
|
||||
[self setupNetworkReachabilityCallback];
|
||||
}else{
|
||||
networkReachabilityCallBack(proxyReachability, flags, 0);
|
||||
if (flags==0){
|
||||
/*workaround iOS bug: reachability API cease to work after some time.*/
|
||||
/*when flags==0, either we have no network, or the reachability object lies. To workaround, create a new one*/
|
||||
[self setupNetworkReachabilityCallback];
|
||||
}
|
||||
}
|
||||
}else ms_error("No proxy reachability context created !");
|
||||
linphone_core_refresh_registers(theLinphoneCore);//just to make sure REGISTRATION is up to date
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue