aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-08 05:59:21 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-08 05:59:21 +0000
commit81be0ad1e52d0a96e24e1a3b96aea2c4ee0f17d7 (patch)
treeb5997191d7a804bbc64d9420a988109ae16df284 /src/or
parentb5075dd81fb4fbedcd9ed5ec3085451586752b25 (diff)
downloadtor-81be0ad1e52d0a96e24e1a3b96aea2c4ee0f17d7.tar.gz
tor-81be0ad1e52d0a96e24e1a3b96aea2c4ee0f17d7.zip
r11486@Kushana: nickm | 2006-12-08 00:58:47 -0500
Fix a longstanding bug in eventdns related to timeouts: The timeout count was never actually reset to 0. Argh. Now we reset it to zero after we get a successful request, or after we notice that a nameserver is back up, or after we decide the nameserver is down because of timeouts. This may fix bug 326. svn:r9054
Diffstat (limited to 'src/or')
-rw-r--r--src/or/eventdns.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c
index 740801ad30..6b28804c97 100644
--- a/src/or/eventdns.c
+++ b/src/or/eventdns.c
@@ -394,7 +394,7 @@ static int global_requests_waiting = 0;
static int global_max_requests_inflight = 64;
-static struct timeval global_timeout = {3, 0}; // 3 seconds
+static struct timeval global_timeout = {5, 0}; // 5 seconds
static int global_max_reissues = 1; // a reissue occurs when we get some errors from the server
static int global_max_retransmits = 3; // number of times we'll retransmit a request which timed out
// number of timeouts in a row before we consider this server to be down
@@ -628,6 +628,7 @@ nameserver_up(struct nameserver *const ns) {
evtimer_del(&ns->timeout_event);
ns->state = 1;
ns->failed_times = 0;
+ ns->timedout = 0;
global_good_nameservers++;
}
@@ -1080,6 +1081,7 @@ nameserver_read(struct nameserver *ns) {
nameserver_failed(ns, strerror(err));
return;
}
+ ns->timedout = 0;
reply_parse(packet, r);
}
}
@@ -1241,6 +1243,7 @@ evdns_request_timeout_callback(int fd, short events, void *arg) {
req->ns->timedout++;
if (req->ns->timedout > global_max_nameserver_timeout) {
+ req->ns->timedout = 0;
nameserver_failed(req->ns, "request timed out.");
}