]> sjero.net Git - linphone/commitdiff
fix: avoid giving LinphoneRegistration* notifications for removed proxy config
authorSimon Morlat <simon.morlat@linphone.org>
Thu, 23 Feb 2012 17:27:56 +0000 (18:27 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Thu, 23 Feb 2012 17:27:56 +0000 (18:27 +0100)
coreapi/callbacks.c
coreapi/proxy.c

index d9296b3671539e7dca50e5057ce73696089d99f9..085a77ebfd05b69146effc471449e75756da3ef0 100644 (file)
@@ -638,6 +638,10 @@ static void register_success(SalOp *op, bool_t registered){
        LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op);
        char *msg;
        
+       if (cfg->deletion_date!=0){
+               ms_message("Registration success for removed proxy config, ignored");
+               return;
+       }
        linphone_proxy_config_set_error(cfg,LinphoneReasonNone);
        linphone_proxy_config_set_state(cfg, registered ? LinphoneRegistrationOk : LinphoneRegistrationCleared ,
                                        registered ? "Registration sucessful" : "Unregistration done");
@@ -658,6 +662,10 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const
                ms_warning("Registration failed for unknown proxy config.");
                return ;
        }
+       if (cfg->deletion_date!=0){
+               ms_message("Registration failed for removed proxy config, ignored");
+               return;
+       }
        if (details==NULL)
                details=_("no response timeout");
        
index 18999dae0bfe7895fe165cd3b498536da240186a..433d68c5adba416c30f6157b2ad1b8e71893dbc2 100644 (file)
@@ -547,8 +547,10 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
        /* add to the list of destroyed proxies, so that the possible unREGISTER request can succeed authentication */
        lc->sip_conf.deleted_proxies=ms_list_append(lc->sip_conf.deleted_proxies,(void *)cfg);
        cfg->deletion_date=ms_time(NULL);
-       /* this will unREGISTER */
-       linphone_proxy_config_edit(cfg);
+       if (cfg->state==LinphoneRegistrationOk){
+               /* this will unREGISTER */
+               linphone_proxy_config_edit(cfg);
+       }
        if (lc->default_proxy==cfg){
                lc->default_proxy=NULL;
        }