[or-cvs] r15230: implement proposal 138: removing down routers from consensus (in tor/trunk: . src/or)

weasel at seul.org weasel at seul.org
Fri Jun 13 21:22:51 UTC 2008


Author: weasel
Date: 2008-06-13 17:22:49 -0400 (Fri, 13 Jun 2008)
New Revision: 15230

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/dirvote.c
Log:
implement proposal 138: removing down routers from consensus


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-06-13 20:49:40 UTC (rev 15229)
+++ tor/trunk/ChangeLog	2008-06-13 21:22:49 UTC (rev 15230)
@@ -1,6 +1,9 @@
 Changes in version 0.2.1.2-alpha - 2008-??-??
   o Minor features:
     - Allow OpenSSL to use dynamic locks if it wants.
+    - When building a consensus do not include routers that are down.
+      This will cut down 30% to 40% on consensus size.  Implements
+      proposal 138.
   o Bugfixes:
     - Asking for a conditional consensus at .../consensus/<fingerprints>
       would crash a dirserver if it did not already have a consensus.

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2008-06-13 20:49:40 UTC (rev 15229)
+++ tor/trunk/src/or/dirvote.c	2008-06-13 21:22:49 UTC (rev 15230)
@@ -105,7 +105,7 @@
     tor_snprintf(status, len,
                  "network-status-version 3\n"
                  "vote-status vote\n"
-                 "consensus-methods 1 2 3\n"
+                 "consensus-methods 1 2 3 4\n"
                  "published %s\n"
                  "valid-after %s\n"
                  "fresh-until %s\n"
@@ -443,7 +443,7 @@
 static int
 consensus_method_is_supported(int method)
 {
-  return (method >= 1) && (method <= 3);
+  return (method >= 1) && (method <= 4);
 }
 
 /** Given a list of vote networkstatus_t in <b>votes</b>, our public
@@ -788,7 +788,7 @@
       const char *lowest_id = NULL;
       const char *chosen_version;
       const char *chosen_name = NULL;
-      int is_named = 0, is_unnamed = 0;
+      int is_named = 0, is_unnamed = 0, is_running = 0;
       int naming_conflict = 0;
       int n_listing = 0;
       int i;
@@ -892,11 +892,19 @@
           if (is_unnamed)
             smartlist_add(chosen_flags, (char*)fl);
         } else {
-          if (flag_counts[fl_sl_idx] > n_flag_voters[fl_sl_idx]/2)
+          if (flag_counts[fl_sl_idx] > n_flag_voters[fl_sl_idx]/2) {
             smartlist_add(chosen_flags, (char*)fl);
+            if (!strcmp(fl, "Running"))
+              is_running = 1;
+          }
         }
       });
 
+      /* Starting with consensus method 4 we do not list servers
+       * that are not running in a consensus.  See Proposal 138 */
+      if (consensus_method >= 4 && !is_running)
+        continue;
+
       /* Pick the version. */
       if (smartlist_len(versions)) {
         sort_version_list(versions, 0);
@@ -2057,4 +2065,3 @@
   }
   return NULL;
 }
-



More information about the tor-commits mailing list