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

[or-cvs] r10153: Backport candidate: count it as a failure if we fetch a vali (in tor/trunk: doc/spec src/or)



Author: arma
Date: 2007-05-10 01:12:20 -0400 (Thu, 10 May 2007)
New Revision: 10153

Modified:
   tor/trunk/doc/spec/dir-spec-v2.txt
   tor/trunk/src/or/routerlist.c
Log:
Backport candidate: 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.


Modified: tor/trunk/doc/spec/dir-spec-v2.txt
===================================================================
--- tor/trunk/doc/spec/dir-spec-v2.txt	2007-05-10 04:04:44 UTC (rev 10152)
+++ tor/trunk/doc/spec/dir-spec-v2.txt	2007-05-10 05:12:20 UTC (rev 10153)
@@ -658,9 +658,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/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-05-10 04:04:44 UTC (rev 10152)
+++ tor/trunk/src/or/routerlist.c	2007-05-10 05:12:20 UTC (rev 10153)
@@ -2795,6 +2795,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.",
@@ -2809,16 +2810,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);