Merge remote-tracking branch 'origin/pr/86'

This commit is contained in:
Nick Mathewson 2013-12-06 10:37:53 -05:00
commit aeb8d345b4
2 changed files with 19 additions and 0 deletions

13
evdns.c
View File

@ -4044,6 +4044,19 @@ evdns_base_free(struct evdns_base *base, int fail_requests)
evdns_base_free_and_unlock(base, fail_requests);
}
void
evdns_base_flush_outdated_host_addresses(struct evdns_base *base)
{
EVDNS_LOCK(base);
struct hosts_entry *victim;
while ((victim = TAILQ_FIRST(&base->hostsdb))) {
TAILQ_REMOVE(&base->hostsdb, victim, next);
mm_free(victim);
}
EVDNS_UNLOCK(base);
EVTHREAD_FREE_LOCK(base->lock, EVTHREAD_LOCKTYPE_RECURSIVE);
}
void
evdns_shutdown(int fail_requests)
{

View File

@ -237,6 +237,12 @@ struct evdns_base * evdns_base_new(struct event_base *event_base, int initialize
*/
void evdns_base_free(struct evdns_base *base, int fail_requests);
/**
All previous outdated host addresses will be removed or flushed from the event base.
@param evdns_base the evdns base to flush outdated host addresses
*/
void evdns_base_flush_outdated_host_addresses(struct evdns_base *base);
/**
Convert a DNS error code to a string.