summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-01-04 19:47:12 +0000
committerNick Mathewson <nickm@torproject.org>2009-01-04 19:47:12 +0000
commit360a059948e47b69bd86caf3b1de698954093df8 (patch)
tree549750e8849c92fede5fcee295544434b701ac93
parentb5429e64c40802f1c88fd78f618e683503752d59 (diff)
downloadtor-360a059948e47b69bd86caf3b1de698954093df8.tar.gz
tor-360a059948e47b69bd86caf3b1de698954093df8.zip
Fix an xxx021: do not remove routerinfos as too old and unlisted unless we have a consensus. Backport candidate.
svn:r17886
-rw-r--r--ChangeLog2
-rw-r--r--src/or/routerlist.c20
2 files changed, 14 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 87d410d44f..9ba226cb73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,8 @@ Changes in version 0.2.1.10-alpha - 2009-01-??
- If we are retrying something slowly over and over, do not
automatically give up after the 254th failure. Bugfix on
0.2.1.9-alpha.
+ - Do not remove routers as too old if we do not have any consensus
+ document. Bugfix on 0.2.0.7-alpha.
o Deprecated and removed features:
- The old "tor --version --version" command, which would spit out the
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 305c1debc7..f145d42232 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3232,6 +3232,7 @@ routerlist_remove_old_routers(void)
int caches = directory_caches_dir_info(get_options());
const networkstatus_t *consensus = networkstatus_get_latest_consensus();
const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
+ int have_enough_v2;
trusted_dirs_remove_old_certs();
@@ -3286,14 +3287,17 @@ routerlist_remove_old_routers(void)
digestset_add(retain, rs->descriptor_digest));
}
- /* If we have nearly as many networkstatuses as we want, 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 routers.) */
- /* XXX021 we don't check if we have a v3 consensus, do we? should we? -RD */
- if (!caches ||
- (networkstatus_v2_list &&
- smartlist_len(networkstatus_v2_list) > get_n_v2_authorities() / 2)) {
+ /* If we have a consensus, and nearly as many v2 networkstatuses as we want,
+ * we should consider pruning current routers that are too old and that
+ * nobody recommends. (If we don't have a consensus or enough v2
+ * networkstatuses, then we should get more before we decide to kill
+ * routers.) */
+ /* we set this to true iff we don't care about v2 info, or we have enough. */
+ have_enough_v2 = !caches ||
+ (networkstatus_v2_list &&
+ smartlist_len(networkstatus_v2_list) > get_n_v2_authorities() / 2);
+
+ if (have_enough_v2 && consensus) {
cutoff = now - ROUTER_MAX_AGE;
/* Remove too-old unrecommended members of routerlist->routers. */
for (i = 0; i < smartlist_len(routerlist->routers); ++i) {