evdns: fail ns after we are failing/retrasmitting request

In case we are failing request (evdns_request_timeout_callback()), we
delete timeout_event in request_finished(), while just before calling
request_finished() (for failing request) there was a call to
nameserver_failed(), that add event for timeout_event, IOW we must fail
ns after request because otherwise we will not have timeout_event
actived, and we will waiting forever.

Before this patch the dns/retry_disable_when_inactive will wait forever,
after - OK.
This commit is contained in:
Azat Khuzhin 2014-09-30 01:34:04 +04:00
parent 3ca9d43d32
commit 97c750d660

13
evdns.c
View File

@ -2170,12 +2170,6 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) {
log(EVDNS_LOG_DEBUG, "Request %p timed out", arg);
EVDNS_LOCK(base);
req->ns->timedout++;
if (req->ns->timedout > req->base->global_max_nameserver_timeout) {
req->ns->timedout = 0;
nameserver_failed(req->ns, "request timed out.");
}
if (req->tx_count >= req->base->global_max_retransmits) {
/* this request has failed */
log(EVDNS_LOG_DEBUG, "Giving up on request %p; tx_count==%d",
@ -2190,6 +2184,13 @@ evdns_request_timeout_callback(evutil_socket_t fd, short events, void *arg) {
request_swap_ns(req, nameserver_pick(base));
evdns_request_transmit(req);
}
req->ns->timedout++;
if (req->ns->timedout > req->base->global_max_nameserver_timeout) {
req->ns->timedout = 0;
nameserver_failed(req->ns, "request timed out.");
}
EVDNS_UNLOCK(base);
}