Hi, all! This patch fixes a bug in nameserver timeouts in evdns.c. Previously, we would count the number of successive requests that had timed out in a row for each nameserver, but we would never actually reset the timeout count to zero. This, obviously, would create problems: see the Tor bugtracker entry at http://bugs.noreply.org/flyspray/index.php?id=326&do=details
This patch resets the successive timeout count to zero when: - A nameserver comes up - We receive a reply from a nameserver - We decide to not use the nameserver for a while because of its timeout count. This patch also changes the timeout threshold from 3 to 5 seconds. Probably, it should be easier to adjust. There may also be other issues that cause spurious nameserver timeouts: see the final comment in the bugtracker link above. yrs, -- Nick Mathewson
=== evdns.c ================================================================== --- evdns.c (revision 11485) +++ evdns.c (local) @@ -212,7 +212,7 @@ 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 @@ -447,6 +447,7 @@ evtimer_del(&ns->timeout_event); ns->state = 1; ns->failed_times = 0; + ns->timedout = 0; global_good_nameservers++; } @@ -891,6 +892,7 @@ nameserver_failed(ns, strerror(err)); return; } + ns->timedout = 0; reply_parse(packet, r); } } @@ -1051,6 +1053,7 @@ req->ns->timedout++; if (req->ns->timedout > global_max_nameserver_timeout) { + req->ns->timedout = 0; nameserver_failed(req->ns, "request timed out."); }
pgpPXZxJJbo7L.pgp
Description: PGP signature
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users