mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 04:19:10 -04:00
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:
parent
da1718b289
commit
2df1f82bfa
6
evdns.c
6
evdns.c
@ -616,8 +616,9 @@ nameserver_failed(struct nameserver *const ns, const char *msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nameserver_up(struct nameserver *const ns) {
|
nameserver_up(struct nameserver *const ns)
|
||||||
EVDNS_LOCK(ns->base);
|
{
|
||||||
|
ASSERT_LOCKED(ns->base);
|
||||||
if (ns->state) return;
|
if (ns->state) return;
|
||||||
log(EVDNS_LOG_WARN, "Nameserver %s is back up",
|
log(EVDNS_LOG_WARN, "Nameserver %s is back up",
|
||||||
debug_ntop((struct sockaddr *)&ns->address));
|
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;
|
v4_timedout = 1;
|
||||||
EVDNS_LOCK(data->evdns_base);
|
EVDNS_LOCK(data->evdns_base);
|
||||||
++data->evdns_base->getaddrinfo_ipv4_timeouts;
|
++data->evdns_base->getaddrinfo_ipv4_timeouts;
|
||||||
|
EVDNS_UNLOCK(data->evdns_base);
|
||||||
}
|
}
|
||||||
if (data->ipv6_request.r) {
|
if (data->ipv6_request.r) {
|
||||||
evdns_cancel_request(NULL, data->ipv6_request.r);
|
evdns_cancel_request(NULL, data->ipv6_request.r);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user