From: Jehan Monnier Date: Wed, 16 Jun 2010 14:05:05 +0000 (+0200) Subject: destroy cleared proxy config after 5 seconds X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=d21df41a760b67f13fdba03b612e94e6720abf61 destroy cleared proxy config after 5 seconds --- diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b369bb82..75bfee8a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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){ diff --git a/coreapi/proxy.c b/coreapi/proxy.c index babd13e3..59d76730 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -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 @@ -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) { +