diff options
author | Zhuang Yuyao <mlistz@gmail.com> | 2009-11-27 16:02:49 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-11-27 17:36:51 -0500 |
commit | 2df1f82bfa1b432a277b0e1f8fc65aed7898f5e5 (patch) | |
tree | 2fb0905bf07f216c092e8fefe5faa5abb1f05176 | |
parent | da1718b28992076e5cceb68e1715244a7dbd9669 (diff) | |
download | libevent-2df1f82bfa1b432a277b0e1f8fc65aed7898f5e5.tar.gz |
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().
-rw-r--r-- | evdns.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |