summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-03-22 21:32:42 +0000
committerRoger Dingledine <arma@torproject.org>2006-03-22 21:32:42 +0000
commit20e66a799bcc8bfb47ea8f682eed77b1962fa923 (patch)
tree0293f33b8f52d48e34df9e31f98612d35d5f7d20
parent58307cd8dee29f6e4d8a992abeace5ccd2c0d85c (diff)
downloadtor-20e66a799bcc8bfb47ea8f682eed77b1962fa923.tar.gz
tor-20e66a799bcc8bfb47ea8f682eed77b1962fa923.zip
Resolve problem found by weasel: the v1 directory was including
servers as much as 48 hours old, because that's how the new routerlist->routers works. Now only include them if they're 20 hours old or less. svn:r6230
-rw-r--r--src/or/dirserv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 3073880a63..86e3443fda 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -799,11 +799,12 @@ dirserv_dump_directory_to_string(char **dir_out,
char *recommended_versions;
char digest[DIGEST_LEN];
char published[ISO_TIME_LEN+1];
- time_t published_on;
char *buf = NULL;
size_t buf_len;
size_t identity_pkey_len;
routerlist_t *rl = router_get_routerlist();
+ time_t now = time(NULL);
+ time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
tor_assert(dir_out);
*dir_out = NULL;
@@ -820,13 +821,13 @@ dirserv_dump_directory_to_string(char **dir_out,
recommended_versions =
format_versions_list(get_options()->RecommendedVersions);
- published_on = time(NULL);
- format_iso_time(published, published_on);
+ format_iso_time(published, now);
buf_len = 2048+strlen(recommended_versions)+
strlen(router_status);
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri,
- buf_len += ri->cache_info.signed_descriptor_len+1);
+ if (ri->cache_info.published_on >= cutoff)
+ buf_len += ri->cache_info.signed_descriptor_len+1);
buf = tor_malloc(buf_len);
/* We'll be comparing against buf_len throughout the rest of the
function, though strictly speaking we shouldn't be able to exceed
@@ -851,6 +852,8 @@ dirserv_dump_directory_to_string(char **dir_out,
{
size_t len = ri->cache_info.signed_descriptor_len;
const char *body;
+ if (ri->cache_info.published_on < cutoff)
+ continue;
if (cp+len+1 >= buf+buf_len)
goto truncated;
body = signed_descriptor_get_body(&ri->cache_info);