]> sjero.net Git - linphone/commitdiff
destroy cleared proxy config after 5 seconds
authorJehan Monnier <jehan.monnier@linphone.org>
Wed, 16 Jun 2010 14:05:05 +0000 (16:05 +0200)
committerJehan Monnier <jehan.monnier@linphone.org>
Wed, 16 Jun 2010 14:05:05 +0000 (16:05 +0200)
coreapi/linphonecore.c
coreapi/proxy.c

index b369bb82c09d974e7db436852cc2051dda606dae..75bfee8ab6343caa28321550d24ed44ee877dcce 100644 (file)
@@ -1646,6 +1646,16 @@ static void monitor_network_state(LinphoneCore *lc, time_t curtime){
 
 static void proxy_update(LinphoneCore *lc){
        ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
+       MSList* list=ms_list_copy(lc->sip_conf.deleted_proxies);
+       for(;list!=NULL;list=list->next){
+               LinphoneProxyConfig* cfg = (LinphoneProxyConfig*) list->data;
+               if (ms_time(NULL) - cfg->deletion_date > 5) {
+                       lc->sip_conf.deleted_proxies =ms_list_remove(lc->sip_conf.deleted_proxies,(void *)cfg);
+                       ms_message("clearing proxy config for [%s]",linphone_proxy_config_get_addr(cfg));
+                       linphone_proxy_config_destroy(cfg);
+               }
+       }
+       ms_list_free(list);
 }
 
 static void assign_buddy_info(LinphoneCore *lc, BuddyInfo *info){
index babd13e34600c97e1dc6047616770b6a515bea2b..59d767303dfbde7b4f4635372fa1c55714e51f35 100644 (file)
@@ -22,6 +22,7 @@ Copyright (C) 2000  Simon MORLAT (simon.morlat@linphone.org)
 #include "sipsetup.h"
 #include "lpconfig.h"
 #include "private.h"
+#include "mediastreamer2/mediastream.h"
 
 
 #include <ctype.h>
@@ -505,6 +506,7 @@ void linphone_core_remove_proxy_config(LinphoneCore *lc, LinphoneProxyConfig *cf
        lc->sip_conf.proxies=ms_list_remove(lc->sip_conf.proxies,(void *)cfg);
        /* 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 (lc->default_proxy==cfg){
@@ -793,3 +795,4 @@ void * linphone_proxy_config_get_user_data(LinphoneProxyConfig *cr) {
 
 
 
+