diff options
author | Roger Dingledine <arma@torproject.org> | 2006-02-05 02:07:28 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-02-05 02:07:28 +0000 |
commit | 53f86cdf5d50affb12f316cca4bd43a46cc66e7c (patch) | |
tree | 30d96777ecf8e8d5ab2cdaa623f700de49b85db4 | |
parent | 4c1fa73c7e7e7d68078d2cb5297d76c2e83715c4 (diff) | |
download | tor-53f86cdf5d50affb12f316cca4bd43a46cc66e7c.tar.gz tor-53f86cdf5d50affb12f316cca4bd43a46cc66e7c.zip |
fix bug: we were caching the newest descriptor for each server,
well, forever. i imagine this just keeps growing in size.
svn:r5912
-rw-r--r-- | src/or/routerlist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 3ac9ee0490..03fe208221 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1708,7 +1708,8 @@ routerlist_remove_old_routers(void) { int i, hi=-1; const char *cur_id = NULL; - time_t now, cutoff; + time_t now = time(NULL); + time_t cutoff; routerinfo_t *router; signed_descriptor_t *sd; digestmap_t *retain; @@ -1717,15 +1718,16 @@ routerlist_remove_old_routers(void) return; retain = digestmap_new(); + cutoff = now - OLD_ROUTER_DESC_MAX_AGE; if (server_mode(options) && options->DirPort) { SMARTLIST_FOREACH(networkstatus_list, networkstatus_t *, ns, { SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs, - digestmap_set(retain, rs->descriptor_digest, (void*)1)); + if (rs->published_on >= cutoff) + digestmap_set(retain, rs->descriptor_digest, (void*)1)); }); } - now = time(NULL); cutoff = now - ROUTER_MAX_AGE; /* Remove too-old members of routerlist->routers. */ for (i = 0; i < smartlist_len(routerlist->routers); ++i) { |