From af33a19266954fa40e4f2b80764d304ff5e3e82d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 14 Apr 2016 14:21:32 +0200 Subject: [PATCH] tunnel: turn off autodetection if network is not reachable anymore --- coreapi/TunnelManager.cc | 6 ++++++ tester/tunnel_tester.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/coreapi/TunnelManager.cc b/coreapi/TunnelManager.cc index ab3dc6c55..f992c0dd1 100644 --- a/coreapi/TunnelManager.cc +++ b/coreapi/TunnelManager.cc @@ -398,6 +398,12 @@ void TunnelManager::networkReachableCb(LinphoneCore *lc, bool_t reachable) { LOGI("TunnelManager: Network is now reachable, starting auto detection"); tunnel->startAutoDetection(); tunnel->mState = autodetecting; + } else if (!reachable && tunnel->mState == autodetecting) { + // if network is no more reachable, cancel autodetection + for(UdpMirrorClientList::iterator udpMirror = tunnel->mUdpMirrorClients.begin(); udpMirror != tunnel->mUdpMirrorClients.end(); udpMirror++) { + udpMirror->stop(); + } + tunnel->mState = disabled; } linphone_core_get_local_ip_for(AF_INET, NULL,tunnel->mLocalAddr); } diff --git a/tester/tunnel_tester.c b/tester/tunnel_tester.c index 19ece5c7d..0d853ac6a 100644 --- a/tester/tunnel_tester.c +++ b/tester/tunnel_tester.c @@ -255,16 +255,15 @@ static void register_on_second_tunnel(void) { linphone_tunnel_simulate_udp_loss(tunnel, TRUE); + linphone_tunnel_config_set_host(config, "tunnel.linphone.org"); // add a first tunnel config with an invalid port linphone_tunnel_config_set_port(config, 4141); - linphone_tunnel_config_set_host(config, "tunnel.linphone2.org"); linphone_tunnel_config_set_remote_udp_mirror_port(config, 54321); linphone_tunnel_add_server(tunnel, config); // then a proper server linphone_tunnel_config_set_port(config, 443); - linphone_tunnel_config_set_host(config, "tunnel.linphone.org"); linphone_tunnel_config_set_remote_udp_mirror_port(config, 12345); linphone_tunnel_add_server(tunnel, config);