Commit 28f4a815 authored by Simon Morlat's avatar Simon Morlat
Browse files

prevent concurrent registers using linphone_core_refresh_registers() being called multiple times.

parent 2ae47193
...@@ -365,7 +365,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){ ...@@ -365,7 +365,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
* This is useful if for example you resuming from suspend, thus IP address may have changed. * This is useful if for example you resuming from suspend, thus IP address may have changed.
**/ **/
void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){ void linphone_proxy_config_refresh_register(LinphoneProxyConfig *obj){
if (obj->reg_sendregister && obj->op){ if (obj->reg_sendregister && obj->op && obj->state!=LinphoneRegistrationProgress){
if (sal_register_refresh(obj->op,obj->expires) == 0) { if (sal_register_refresh(obj->op,obj->expires) == 0) {
linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress, "Refresh registration"); linphone_proxy_config_set_state(obj,LinphoneRegistrationProgress, "Refresh registration");
} }
...@@ -1326,15 +1326,16 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) { ...@@ -1326,15 +1326,16 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState state, const char *message){
LinphoneCore *lc=cfg->lc; LinphoneCore *lc=cfg->lc;
bool_t update_friends=FALSE; bool_t update_friends=FALSE;
if (linphone_core_should_subscribe_friends_only_when_registered(lc)){
update_friends=(state==LinphoneRegistrationOk && cfg->state!=LinphoneRegistrationOk) if (cfg->state!=state || state==LinphoneRegistrationOk) { /*allow multiple notification of LinphoneRegistrationOk for refreshing*/
|| (state!=LinphoneRegistrationOk && cfg->state==LinphoneRegistrationOk); 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 (linphone_core_should_subscribe_friends_only_when_registered(lc)){
update_friends=(state==LinphoneRegistrationOk && cfg->state!=LinphoneRegistrationOk)
|| (state!=LinphoneRegistrationOk && cfg->state==LinphoneRegistrationOk);
}
cfg->state=state; cfg->state=state;
if (update_friends){ if (update_friends){
......
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