destroy cleared proxy config after 5 seconds

This commit is contained in:
Jehan Monnier 2010-06-16 16:05:05 +02:00
parent 6d5eeb0dd7
commit d21df41a76
2 changed files with 13 additions and 0 deletions

View 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){

View 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) {