Special-case for retrieving own networkstatus by fingerprint: regenerate if dirty!

svn:r4943
This commit is contained in:
Nick Mathewson 2005-09-08 19:29:21 +00:00
parent 465aec04c1
commit 6c4d43c724

View File

@ -1183,13 +1183,19 @@ dirserv_get_networkstatus_v2(smartlist_t *result,
smartlist_add(result, val);
}
} else if (!strcmpstart(key, "fp/")) {
char own_fp[HEX_DIGEST_LEN+1];
crypto_pk_get_fingerprint(get_identity_key(), own_fp, 0);
smartlist_t *hexdigests = smartlist_create();
smartlist_split_string(hexdigests, key+3, "+", 0, 0);
SMARTLIST_FOREACH(hexdigests, char *, cp,
{
cached_dir_t *cached;
tor_strupper(cp);
/* XXXX special-case own key? */
if (!strcmp(cp, own_fp) &&
get_options()->AuthoritativeDir &&
the_v2_networkstatus_is_dirty &&
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL))
generate_v2_networkstatus();
cached = strmap_get(cached_v2_networkstatus, cp);
if (cached)
smartlist_add(result, cached);