Fix an evdns lock violation.

Original message:

   evdns contains a bug related to thread lock.

   enable thread lock by evthread_use_pthreads() will cause successive
   evdns_base_resolve_ipv4() (and other resolve functions i think) to
   hang on EVDNS_LOCK(base) after one or several successful call to
   evdns_base_resolve_ipv4().
This commit is contained in:
Zhuang Yuyao 2009-11-27 16:02:49 -05:00 committed by Nick Mathewson
parent da1718b289
commit 2df1f82bfa

View File

@ -616,8 +616,9 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
}
static void
nameserver_up(struct nameserver *const ns) {
EVDNS_LOCK(ns->base);
nameserver_up(struct nameserver *const ns)
{
ASSERT_LOCKED(ns->base);
if (ns->state) return;
log(EVDNS_LOG_WARN, "Nameserver %s is back up",
debug_ntop((struct sockaddr *)&ns->address));
@ -3895,6 +3896,7 @@ evdns_getaddrinfo_timeout_cb(evutil_socket_t fd, short what, void *ptr)
v4_timedout = 1;
EVDNS_LOCK(data->evdns_base);
++data->evdns_base->getaddrinfo_ipv4_timeouts;
EVDNS_UNLOCK(data->evdns_base);
}
if (data->ipv6_request.r) {
evdns_cancel_request(NULL, data->ipv6_request.r);