From 1915367124953939c3d2ea44733d8b27e093d601 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 12 Apr 2011 10:07:20 +0200 Subject: [PATCH] only use www.linphone.org for testing network recheability --- Classes/LinphoneUI/LinphoneManager.m | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index 014157ebe..5e486983b 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -398,9 +398,6 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach //set to default proxy linphone_core_set_default_proxy(theLinphoneCore,proxyCfg); - LinphoneAddress* addr=linphone_address_new(linphone_proxy_config_get_addr(proxyCfg)); - proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr)); - } else { if (configCheckDisable == false ) { UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Warning" @@ -410,12 +407,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach otherButtonTitles:@"Never remind",nil]; [error show]; } - - proxyReachability=SCNetworkReachabilityCreateWithName(nil, "linphone.org"); } - proxyReachabilityContext.info=self; - SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext); - SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); //Configure Codecs @@ -461,7 +453,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization linphone_core_destroy(theLinphoneCore); theLinphoneCore = nil; - } + SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + CFRelease(proxyReachability); + proxyReachability=nil; + + } + } //**********************BG mode management*************************/////////// @@ -600,6 +597,12 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach [[NSUserDefaults standardUserDefaults] synchronize];//sync before loading config [ self doLinphoneConfiguration:nil]; + + proxyReachability=SCNetworkReachabilityCreateWithName(nil, "linphone.org"); + proxyReachabilityContext.info=self; + SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext); + SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doLinphoneConfiguration:) name:NSUserDefaultsDidChangeNotification object:nil];