[or-cvs] r11895: Add the routers in the latest consensus to the list of route (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Fri Oct 12 17:13:09 UTC 2007


Author: nickm
Date: 2007-10-12 13:13:09 -0400 (Fri, 12 Oct 2007)
New Revision: 11895

Modified:
   tor/trunk/
   tor/trunk/src/or/routerlist.c
Log:
 r15719 at catbus:  nickm | 2007-10-12 13:07:45 -0400
 Add the routers in the latest consensus to the list of routers to retain when removing old ones.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15719] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-10-12 09:46:03 UTC (rev 11894)
+++ tor/trunk/src/or/routerlist.c	2007-10-12 17:13:09 UTC (rev 11895)
@@ -2860,6 +2860,7 @@
 void
 routerlist_remove_old_routers(void)
 {
+  /* XXXX020 call me less often */
   int i, hi=-1;
   const char *cur_id = NULL;
   time_t now = time(NULL);
@@ -2878,7 +2879,7 @@
 
   retain = digestmap_new();
   cutoff = now - OLD_ROUTER_DESC_MAX_AGE;
-  /* Build a list of all the descriptors that _anybody_ recommends. */
+  /* Build a list of all the descriptors that _anybody_ lists. */
   SMARTLIST_FOREACH(networkstatus_list, networkstatus_t *, ns,
     {
       /* XXXX The inner loop here gets pretty expensive, and actually shows up
@@ -2894,6 +2895,16 @@
           digestmap_set(retain, rs->descriptor_digest, (void*)1));
     });
 
+  {
+    /* Retain anything listed in the consensus. */
+    networkstatus_vote_t *ns = networkstatus_get_latest_consensus();
+    if (ns) {
+      SMARTLIST_FOREACH(ns->routerstatus_list, routerstatus_t *, rs,
+        if (rs->published_on >= cutoff)
+          digestmap_set(retain, rs->descriptor_digest, (void*)1));
+    }
+  }
+
   /* If we have a bunch of networkstatuses, we should consider pruning current
    * routers that are too old and that nobody recommends.  (If we don't have
    * enough networkstatuses, then we should get more before we decide to kill



More information about the tor-commits mailing list