[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10177: backport r10153 and r10156 (in tor/branches/tor-0_1_2-patches: . doc/spec src/or)



Author: arma
Date: 2007-05-12 20:46:50 -0400 (Sat, 12 May 2007)
New Revision: 10177

Modified:
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/doc/spec/dir-spec.txt
   tor/branches/tor-0_1_2-patches/src/or/routerlist.c
Log:
backport r10153 and r10156


Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-13 00:14:48 UTC (rev 10176)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-13 00:46:50 UTC (rev 10177)
@@ -8,7 +8,13 @@
       to corrupt memory under some really unlikely scenarios.
     - If a directory authority is down, skip it when deciding where to get
       networkstatus objects or descriptors. Otherwise we keep asking
-      every 10 seconds forever.
+      every 10 seconds forever. Fixes bug 384.
+    - Count it as a failure if we fetch a valid network-status but we
+      don't want to keep it. Otherwise we'll keep fetching it and keep
+      not wanting to keep it. Fixes part of bug 422.
+    - If all of our dirservers have given us bad or no networkstatuses
+      lately, then stop hammering them once per minute even when we
+      think they're failed. Fixes another part of bug 422.
 
   o Minor bugfixes:
     - Actually set the purpose correctly for descriptors inserted with

Modified: tor/branches/tor-0_1_2-patches/doc/spec/dir-spec.txt
===================================================================
--- tor/branches/tor-0_1_2-patches/doc/spec/dir-spec.txt	2007-05-13 00:14:48 UTC (rev 10176)
+++ tor/branches/tor-0_1_2-patches/doc/spec/dir-spec.txt	2007-05-13 00:46:50 UTC (rev 10177)
@@ -642,9 +642,10 @@
    When choosing which documents to download, clients treat their list of
    directory authorities as a circular ring, and begin with the authority
    appearing immediately after the authority for their most recently
-   retrieved network-status document.  If this attempt fails, the client
-   retries at other caches several times, before moving on to the next
-   network-status document in sequence.
+   retrieved network-status document.  If this attempt fails (either it
+   fails to download at all, or the one it gets is not as good as the
+   one it has), the client retries at other caches several times, before
+   moving on to the next network-status document in sequence.
 
    Clients discard all network-status documents over 24 hours old.
 

Modified: tor/branches/tor-0_1_2-patches/src/or/routerlist.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-05-13 00:14:48 UTC (rev 10176)
+++ tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-05-13 00:46:50 UTC (rev 10177)
@@ -2529,6 +2529,7 @@
                   ns->networkstatus_digest, DIGEST_LEN)) {
         /* Same one we had before. */
         networkstatus_free(ns);
+        tor_assert(trusted_dir);
         log_info(LD_DIR,
                  "Not replacing network-status from %s (published %s); "
                  "we already have it.",
@@ -2543,16 +2544,19 @@
           }
           old_ns->received_on = arrived_at;
         }
+        ++trusted_dir->n_networkstatus_failures;
         return 0;
       } else if (old_ns->published_on >= ns->published_on) {
         char old_published[ISO_TIME_LEN+1];
         format_iso_time(old_published, old_ns->published_on);
+        tor_assert(trusted_dir);
         log_info(LD_DIR,
                  "Not replacing network-status from %s (published %s);"
                  " we have a newer one (published %s) for this authority.",
                  trusted_dir->description, published,
                  old_published);
         networkstatus_free(ns);
+        ++trusted_dir->n_networkstatus_failures;
         return 0;
       } else {
         networkstatus_free(old_ns);
@@ -2917,8 +2921,12 @@
       ds = smartlist_get(trusted_dir_servers, i);
       if (! ds->is_v2_authority)
         continue;
-      if (n_failed < n_dirservers &&
-          ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES) {
+      if (n_failed >= n_dirservers) {
+        log_info(LD_DIR, "All authorities have failed. Not trying any.");
+        smartlist_free(missing);
+        return;
+      }
+      if (ds->n_networkstatus_failures > NETWORKSTATUS_N_ALLOWABLE_FAILURES) {
         ++n_failed;
         continue;
       }