From 6c4d43c724ff44bc68e52a7bfcd5b79cbbec42d7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 8 Sep 2005 19:29:21 +0000 Subject: [PATCH] Special-case for retrieving own networkstatus by fingerprint: regenerate if dirty! svn:r4943 --- src/or/dirserv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 3c4f03ddac..654cc19889 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -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);