tunnel: turn off autodetection if network is not reachable anymore

This commit is contained in:
Gautier Pelloux-Prayer 2016-04-14 14:21:32 +02:00
parent cf9022757f
commit af33a19266
2 changed files with 7 additions and 2 deletions

View file

@ -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);
}

View file

@ -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);