diff options
author | Azat Khuzhin <a3at.mail@gmail.com> | 2014-09-30 01:34:04 +0400 |
---|---|---|
committer | Azat Khuzhin <a3at.mail@gmail.com> | 2014-09-30 01:40:44 +0400 |
commit | 97c750d6602517f22a1100f16592b421c38f2a45 (patch) | |
tree | 4bb8d1baa35d13e0ddf485708dad69c95370f65b | |
parent | 3ca9d43d3233c6946de9fa31932586b905cb8d16 (diff) | |
download | libevent-97c750d6602517f22a1100f16592b421c38f2a45.tar.gz |
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.
-rw-r--r-- | evdns.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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); } |