From 601dda0508151ab09a5d598471ab5efbb8e7cdbe Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Fri, 26 Jul 2019 16:34:43 +0200 Subject: [PATCH] fix network problem --- Classes/LinphoneAppDelegate.m | 17 ----------------- Classes/LinphoneManager.m | 17 +---------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 13306562c..16003dea3 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -304,23 +304,6 @@ LinphoneManager.instance.conf = TRUE; linphone_core_terminate_all_calls(LC); - // destroyLinphoneCore automatically unregister proxies but if we are using - // remote push notifications, we want to continue receiving them - if (LinphoneManager.instance.pushNotificationToken != nil) { - // trick me! setting network reachable to false will avoid sending unregister - const MSList *proxies = linphone_core_get_proxy_config_list(LC); - BOOL pushNotifEnabled = NO; - while (proxies) { - const char *refkey = linphone_proxy_config_get_ref_key(proxies->data); - pushNotifEnabled = pushNotifEnabled || (refkey && strcmp(refkey, "push_notification") == 0); - proxies = proxies->next; - } - // but we only want to hack if at least one proxy config uses remote push.. - if (pushNotifEnabled) { - linphone_core_set_network_reachable(LC, FALSE); - } - } - [LinphoneManager.instance destroyLinphoneCore]; } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 1976ac434..7eac82958 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -776,16 +776,6 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char withCompletionHandler:^(NSError *_Nullable error) {if (error) LOGD(@"Error while adding notification request : %@", error.description);}]; } - LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config(theLinphoneCore); - BOOL pushNotifEnabled = false; - // handle proxy config if any - if (proxyCfg) { - const char *refkey = proxyCfg ? linphone_proxy_config_get_ref_key(proxyCfg) : NULL; - pushNotifEnabled = (refkey && strcmp(refkey, "push_notification") == 0); - } - if (![LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"] || pushNotifEnabled) { - linphone_core_set_network_reachable(LC, FALSE); - } } LinphoneCallLog *callLog2 = linphone_call_get_call_log(call); const char *call_id2 = linphone_call_log_get_call_id(callLog2); @@ -1933,10 +1923,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat [self destroyLinphoneCore]; [self createLinphoneCore]; // reload friends - [self.fastAddressBook fetchContactsInBackGroundThread]; - - // reset network state to trigger a new network connectivity assessment - linphone_core_set_network_reachable(theLinphoneCore, FALSE); + [self.fastAddressBook fetchContactsInBackGroundThread]; } static int comp_call_id(const LinphoneCall *call, const char *callid) { @@ -2204,8 +2191,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { BOOL pushNotifEnabled = (refkey && strcmp(refkey, "push_notification") == 0); if (pushNotifEnabled) { LOGI(@"Keeping lc core to handle push"); - // Destroy voip socket if any and reset connectivity mode - linphone_core_set_network_reachable(theLinphoneCore, FALSE); return YES; } return NO;