Commit 798bd065 authored by Simon Morlat's avatar Simon Morlat
Browse files

prevent double notification of network reachable true or false.

parent 90ff3d47
...@@ -76,6 +76,12 @@ int sal_register(SalOp *op, const char *proxy, const char *from, int expires){ ...@@ -76,6 +76,12 @@ int sal_register(SalOp *op, const char *proxy, const char *from, int expires){
belle_sip_request_t *req; belle_sip_request_t *req;
belle_sip_uri_t* req_uri; belle_sip_uri_t* req_uri;
if (op->refresher){
belle_sip_refresher_stop(op->refresher);
belle_sip_object_unref(op->refresher);
op->refresher=NULL;
}
op->type=SalOpRegister; op->type=SalOpRegister;
sal_op_set_from(op,from); sal_op_set_from(op,from);
sal_op_set_to(op,from); sal_op_set_to(op,from);
......
...@@ -5554,6 +5554,8 @@ static void linphone_core_uninit(LinphoneCore *lc) ...@@ -5554,6 +5554,8 @@ static void linphone_core_uninit(LinphoneCore *lc)
static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime){
// second get the list of available proxies // second get the list of available proxies
const MSList *elem=linphone_core_get_proxy_config_list(lc); const MSList *elem=linphone_core_get_proxy_config_list(lc);
if (lc->network_reachable==isReachable) return; // no change, ignore.
ms_message("Network state is now [%s]",isReachable?"UP":"DOWN"); ms_message("Network state is now [%s]",isReachable?"UP":"DOWN");
for(;elem!=NULL;elem=elem->next){ for(;elem!=NULL;elem=elem->next){
...@@ -5569,9 +5571,8 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu ...@@ -5569,9 +5571,8 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu
lc->netup_time=curtime; lc->netup_time=curtime;
lc->network_reachable=isReachable; lc->network_reachable=isReachable;
if (!lc->network_reachable) linphone_core_invalidate_friend_subscriptions(lc); if (!lc->network_reachable){
linphone_core_invalidate_friend_subscriptions(lc);
if(!isReachable) {
sal_reset_transports(lc->sal); sal_reset_transports(lc->sal);
} }
#ifdef BUILD_UPNP #ifdef BUILD_UPNP
......
...@@ -1312,10 +1312,10 @@ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrat ...@@ -1312,10 +1312,10 @@ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrat
LinphoneCore *lc=cfg->lc; LinphoneCore *lc=cfg->lc;
ms_message("Proxy config [%p] for identity [%s] moving from state [%s] to [%s]" , cfg ms_message("Proxy config [%p] for identity [%s] moving from state [%s] to [%s]" , cfg,
, linphone_proxy_config_get_identity(cfg) linphone_proxy_config_get_identity(cfg),
, linphone_registration_state_to_string(cfg->state) linphone_registration_state_to_string(cfg->state),
, linphone_registration_state_to_string(state)); linphone_registration_state_to_string(state));
if (cfg->state!=state || state==LinphoneRegistrationOk) { /*allow multiple notification of LinphoneRegistrationOk for refreshing*/ if (cfg->state!=state || state==LinphoneRegistrationOk) { /*allow multiple notification of LinphoneRegistrationOk for refreshing*/
cfg->state=state; cfg->state=state;
if (lc && lc->vtable.registration_state_changed){ if (lc && lc->vtable.registration_state_changed){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment