diff options
author | Kuldeep Gupta <kuldeepjec@gmail.com> | 2013-12-06 16:53:16 +0530 |
---|---|---|
committer | Kuldeep Gupta <kuldeepjec@gmail.com> | 2013-12-06 16:53:16 +0530 |
commit | 954d2f94c047d2ecfd81e61f402096da9ab61f6e (patch) | |
tree | 703a7226cd7f5e89ace2d1c6bbdc1ce88fd74a0c /evdns.c | |
parent | c11e7d919183e4a47324b6fd87e780059a8f1d58 (diff) | |
download | libevent-954d2f94c047d2ecfd81e61f402096da9ab61f6e.tar.gz |
bug fix for issues #293 evdns_base_load_hosts doesn't remove outdated adresses
As mentioned at https://sourceforge.net/p/levent/bugs/293/
created a small function "evdns_base_flush_outdated_host_addresses" which removes all the previous requests of hosts , if user wants to clean up the list of hosts can call and use this function.
Requires function declaration to be added in include/event2/dns.h
Adding it in another patch for the same bug.
Diffstat (limited to 'evdns.c')
-rw-r--r-- | evdns.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -4045,6 +4045,19 @@ evdns_base_free(struct evdns_base *base, int 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) { if (current_base) { |