diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-01-10 04:57:12 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-01-10 04:57:12 +0000 |
commit | 43a4f8c7f301a9e83214b9cbff856b378edfe66b (patch) | |
tree | 86cf93e814f723ffc70050b6399530c8a5e1c5d0 /src/or/dirserv.c | |
parent | 56c55c343e6d4f89ed1274263ef8c6dfbb45d53b (diff) | |
download | tor-43a4f8c7f301a9e83214b9cbff856b378edfe66b.tar.gz tor-43a4f8c7f301a9e83214b9cbff856b378edfe66b.zip |
Be more aggressive about throwing away expired router descriptors: they are of no use to anybody. Better still: dont serve expired descriptors by fingerprint. The only people who ask for them are busted 0.1.1.10 Tors that will throw them away and re-request them after 30 minutes.
svn:r5762
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index e7a52dda6b..95cb6ae019 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1603,6 +1603,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, smartlist_free(digests); } else if (!strcmpstart(key, "/tor/server/fp/")) { smartlist_t *digests = smartlist_create(); + time_t cutoff = time(NULL) - ROUTER_MAX_AGE; key += strlen("/tor/server/fp/"); dir_split_resource_into_fingerprints(key, digests, NULL, 1); SMARTLIST_FOREACH(digests, const char *, d, @@ -1611,7 +1612,11 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, smartlist_add(descs_out, &(router_get_my_routerinfo()->cache_info)); } else { routerinfo_t *ri = router_get_by_digest(d); - if (ri) + /* Don't actually serve a descriptor that everyone will think is + * expired. This is an (ugly) workaround to keep buggy 0.1.1.10 + * Tors from downloading descriptors that they will throw away. + */ + if (ri && ri->cache_info.published_on > cutoff) smartlist_add(descs_out, &(ri->cache_info)); } }); |