From 86686a0ead656f88a9ad354f7f36a72bd7d1873e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 17 Nov 2016 22:38:52 +0100 Subject: [PATCH] Fix 3 bugs: - Failure to REGISTER over UDP when the SIP server has both IPv6 and IPv4 addresses and the network has no IPv6 - Bad handling of wifi network change causing very frequent network disconnections (useless calls to linphone_core_set_network_reachable(lc,FALSE) ) - Fix crash while exiting from settings, due to video_port_range being erroneously created and later accessed. --- Classes/LinphoneCoreSettingsStore.m | 2 +- Classes/LinphoneManager.m | 17 +++++++++++------ submodules/bctoolbox | 2 +- submodules/belle-sip | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 4fc0f37de..6529a0fb7 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -352,7 +352,7 @@ if (minPort != maxPort) [self setObject:[NSString stringWithFormat:@"%d-%d", minPort, maxPort] forKey:@"video_port_preference"]; else - [self setInteger:minPort forKey:@"video_port_preference"]; + [self setObject:[NSString stringWithFormat:@"%d", minPort] forKey:@"video_port_preference"]; } [self setBool:linphone_core_ipv6_enabled(LC) forKey:@"use_ipv6"]; LinphoneMediaEncryption menc = linphone_core_get_media_encryption(LC); diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index e152dae99..19108ce7d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1409,6 +1409,7 @@ static void showNetworkFlags(SCNetworkReachabilityFlags flags) { LOGI(@"%@", log); } +//This callback keeps tracks of wifi SSID changes. static void networkReachabilityNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { LinphoneManager *mgr = LinphoneManager.instance; @@ -1420,11 +1421,17 @@ static void networkReachabilityNotification(CFNotificationCenterRef center, void if ([newSSID compare:mgr.SSID] == NSOrderedSame) return; + + if (newSSID != Nil && newSSID.length > 0 && mgr.SSID != Nil && newSSID.length > 0){ + if (SCNetworkReachabilityGetFlags([mgr getProxyReachability], &flags)) { + LOGI(@"Wifi SSID changed, resesting transports."); + mgr.connectivity=none; //this will trigger a connectivity change in networkReachabilityCallback. + networkReachabilityCallBack([mgr getProxyReachability], flags, nil); + } + } mgr.SSID = newSSID; - if (SCNetworkReachabilityGetFlags([mgr getProxyReachability], &flags)) { - networkReachabilityCallBack([mgr getProxyReachability], flags, nil); - } + } void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *nilCtx) { @@ -1460,9 +1467,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach // else keep default value from linphonecore } - // in case of wifi change (newconnectivity == lm.connectivity == wifi), we must - // reregister because we are using a different router anyway - if (lm.connectivity != newConnectivity || newConnectivity != wwan) { + if (lm.connectivity != newConnectivity) { // connectivity has changed linphone_core_set_network_reachable(theLinphoneCore, false); if (newConnectivity == wwan && proxy && isWifiOnly) { diff --git a/submodules/bctoolbox b/submodules/bctoolbox index d0c166650..7f951f6d3 160000 --- a/submodules/bctoolbox +++ b/submodules/bctoolbox @@ -1 +1 @@ -Subproject commit d0c166650a4a39aaae1d5bc17b5ae64639982930 +Subproject commit 7f951f6d3d25b328de9fb006fbdc43a1463ad8ea diff --git a/submodules/belle-sip b/submodules/belle-sip index 8e6e00bb9..4da1c5ea4 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 8e6e00bb9b080275726384881aae194c39933f93 +Subproject commit 4da1c5ea4db5634beeb92ff7300e160446a594e5