aboutsummaryrefslogtreecommitdiff
path: root/libevent-2.0.20-stable/evdns.c
diff options
context:
space:
mode:
Diffstat (limited to 'libevent-2.0.20-stable/evdns.c')
-rw-r--r--libevent-2.0.20-stable/evdns.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libevent-2.0.20-stable/evdns.c b/libevent-2.0.20-stable/evdns.c
index 8beee70..cf38418 100644
--- a/libevent-2.0.20-stable/evdns.c
+++ b/libevent-2.0.20-stable/evdns.c
@@ -4054,6 +4054,13 @@ evdns_base_parse_hosts_line(struct evdns_base *base, char *line)
memcpy(he->hostname, hostname, namelen+1);
he->addrlen = socklen;
+#if 0
+ fprintf(stderr, "evdns_base_parse_hosts_line: base %p, he %p\n",
+ base, he);
+ fprintf(stderr,
+ "evdns_base_parse_hosts_line: tqh_first %p, tqh_last %p\n",
+ base->hostsdb.tqh_first, base->hostsdb.tqh_last);
+#endif
TAILQ_INSERT_TAIL(&base->hostsdb, he, next);
if (hash)
@@ -4073,6 +4080,15 @@ evdns_base_load_hosts_impl(struct evdns_base *base, const char *hosts_fname)
ASSERT_LOCKED(base);
+ {
+ struct hosts_entry *victim;
+ while ((victim = TAILQ_FIRST(&base->hostsdb))) {
+ TAILQ_REMOVE(&base->hostsdb, victim, next);
+ mm_free(victim);
+ }
+ }
+
+
if (hosts_fname == NULL ||
(err = evutil_read_file(hosts_fname, &str, &len, 0)) < 0) {
char tmp[64];
@@ -4167,7 +4183,7 @@ evdns_err_to_getaddrinfo_err(int e1)
else if (e1 == DNS_ERR_NOTEXIST)
return EVUTIL_EAI_NONAME;
else
- return EVUTIL_EAI_FAIL;
+ return EVUTIL_EAI_FAIL_1;
}
/* Return the more informative of two getaddrinfo errors. */
@@ -4529,7 +4545,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
log(EVDNS_LOG_WARN,
"Call to getaddrinfo_async with no "
"evdns_base configured.");
- cb(EVUTIL_EAI_FAIL, NULL, arg); /* ??? better error? */
+ cb(EVUTIL_EAI_FAIL_2, NULL, arg); /* ??? better error? */
return NULL;
}
}
@@ -4630,7 +4646,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
return data;
} else {
mm_free(data);
- cb(EVUTIL_EAI_FAIL, NULL, arg);
+ cb(EVUTIL_EAI_FAIL_3, NULL, arg);
return NULL;
}
}