From ea5f09dcea66c935c0b8a1afd2cf5b069a0f54fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Wed, 24 Sep 2014 10:16:32 +0200 Subject: [PATCH] Avoid TunnelManager to register or unregister when SIP is disabled --- coreapi/TunnelManager.cc | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index 0fd7212fa..d2fe02120 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -178,17 +178,19 @@ TunnelManager::~TunnelManager(){ } void TunnelManager::doRegistration(){ - LinphoneProxyConfig* lProxy; - linphone_core_get_default_proxy(mCore, &lProxy); - if (lProxy) { - if(linphone_proxy_config_get_state(lProxy) != LinphoneRegistrationProgress) { - linphone_proxy_config_refresh_register(lProxy); - mScheduledRegistration = false; + if(mTunnelizeSipPackets) { + LinphoneProxyConfig* lProxy; + linphone_core_get_default_proxy(mCore, &lProxy); + if (lProxy) { + if(linphone_proxy_config_get_state(lProxy) != LinphoneRegistrationProgress) { + linphone_proxy_config_refresh_register(lProxy); + mScheduledRegistration = false; + } else { + mScheduledRegistration = true; + } } else { - mScheduledRegistration = true; + mScheduledRegistration = false; } - } else { - mScheduledRegistration = false; } } @@ -362,14 +364,7 @@ void TunnelManager::setHttpProxyAuthInfo(const char* username,const char* passwd } void TunnelManager::tunnelizeSipPackets(bool enable){ - if(enable != mTunnelizeSipPackets) { mTunnelizeSipPackets = enable; - if(isConnected()) { - if(mTunnelizeSipPackets) sal_enable_tunnel(mCore->sal, mTunnelClient); - else sal_disable_tunnel(mCore->sal); - doRegistration(); - } - } } bool TunnelManager::tunnelizeSipPacketsEnabled() const {