[or-cvs] r14970: When we switched to using v3 directories, we threw away the (in tor/trunk: . src/or)

arma at seul.org arma at seul.org
Thu Jun 5 10:57:09 UTC 2008


Author: arma
Date: 2008-06-05 06:57:09 -0400 (Thu, 05 Jun 2008)
New Revision: 14970

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/routerlist.c
Log:
When we switched to using v3 directories, we threw away the part of
the "do we have enough directory info?" calculation that checked
how many relays we believed to still be running based on our own
experience. So if we went offline, we never gave up trying to make
new circuits; worse, when we came back online we didn't recognize
that we should give all the relays another chance. Bugfix on
0.2.0.9-alpha; fixes bugs 648 and 675.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-06-05 09:01:18 UTC (rev 14969)
+++ tor/trunk/ChangeLog	2008-06-05 10:57:09 UTC (rev 14970)
@@ -1,4 +1,13 @@
 Changes in version 0.2.1.1-alpha - 2008-??-??
+  o Major bugfixes:
+    - When we switched to using v3 directories, we threw away the part of
+      the "do we have enough directory info?" calculation that checked
+      how many relays we believed to still be running based on our own
+      experience. So if we went offline, we never gave up trying to make
+      new circuits; worse, when we came back online we didn't recognize
+      that we should give all the relays another chance. Bugfix on
+      0.2.0.9-alpha; fixes bugs 648 and 675.
+
   o Minor bugfixes:
     - Stop giving double-close warn when we reject an address for client DNS.
     - On Windows, correctly detect errors when listing the contents of a

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-06-05 09:01:18 UTC (rev 14969)
+++ tor/trunk/src/or/routerlist.c	2008-06-05 10:57:09 UTC (rev 14970)
@@ -4189,10 +4189,11 @@
 static void
 update_router_have_minimum_dir_info(void)
 {
-  int num_present = 0, num_usable=0;
+  int num_present = 0, num_usable=0, num_running=0;
   time_t now = time(NULL);
   int res;
   or_options_t *options = get_options();
+  routerinfo_t *ri;
   const networkstatus_t *consensus =
     networkstatus_get_reasonably_live_consensus(now);
 
@@ -4218,9 +4219,13 @@
   SMARTLIST_FOREACH(consensus->routerstatus_list, routerstatus_t *, rs,
      {
        if (client_would_use_router(rs, now, options)) {
-         ++num_usable;
-         if (router_get_by_digest(rs->identity_digest)) {
-           ++num_present;
+         ++num_usable; /* the consensus says we want it. */
+         /* XXX021 shouldn't we look up by descriptor digest? */
+         ri = router_get_by_digest(rs->identity_digest);
+         if (ri) {
+           ++num_present; /* we have some descriptor for it. */
+           if (ri->is_running)
+             ++num_running; /* our local status says it's still up. */
          }
        }
      });
@@ -4229,10 +4234,10 @@
     tor_snprintf(dir_info_status, sizeof(dir_info_status),
             "We have only %d/%d usable descriptors.", num_present, num_usable);
     res = 0;
-  } else if (num_present < 2) {
+  } else if (num_running < 2) {
     tor_snprintf(dir_info_status, sizeof(dir_info_status),
-                 "Only %d usable descriptor%s known!", num_present,
-                 num_present ? "" : "s");
+                 "Only %d descriptor%s believed reachable!", num_running,
+                 num_running ? "" : "s");
     res = 0;
   } else {
     res = 1;
@@ -4247,7 +4252,7 @@
   if (!res && have_min_dir_info) {
     log(LOG_NOTICE, LD_DIR,"Our directory information is no longer up-to-date "
         "enough to build circuits.%s",
-        num_usable > 2 ? "" : " (Not enough servers seem reachable -- "
+        num_running > 2 ? "" : " (Not enough servers seem reachable -- "
         "is your network connection down?)");
     control_event_client_status(LOG_NOTICE, "NOT_ENOUGH_DIR_INFO");
   }



More information about the tor-commits mailing list