fetch unknown descriptors if we see them in a vote

This commit is contained in:
Roger Dingledine
2010-04-20 03:03:33 -04:00
parent 77babb832a
commit 2e692bd8c9
3 changed files with 11 additions and 6 deletions
+3
View File
@@ -2685,6 +2685,9 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
goto err;
}
/* Fetch any new router descriptors we just learned about */
update_consensus_router_descriptor_downloads(time(NULL), 1, vote);
/* Now see whether we already have a vote from this authority. */
SMARTLIST_FOREACH(pending_vote_list, pending_vote_t *, v, {
if (! memcmp(v->vote->cert->cache_info.identity_digest,
+2
View File
@@ -5086,6 +5086,8 @@ trusted_dir_server_t *add_trusted_dir_server(const char *nickname,
void authority_cert_free(authority_cert_t *cert);
void clear_trusted_dir_servers(void);
int any_trusted_dir_is_v1_authority(void);
void update_consensus_router_descriptor_downloads(time_t now, int is_vote,
networkstatus_t *consensus);
void update_router_descriptor_downloads(time_t now);
void update_extrainfo_downloads(time_t now);
int router_have_minimum_dir_info(void);
+6 -6
View File
@@ -27,8 +27,6 @@ static int router_nickname_matches(routerinfo_t *router, const char *nickname);
static void trusted_dir_server_free(trusted_dir_server_t *ds);
static void launch_router_descriptor_downloads(smartlist_t *downloadable,
time_t now);
static void update_consensus_router_descriptor_downloads(time_t now,
networkstatus_t *consensus);
static int signed_desc_digest_is_recognized(signed_descriptor_t *desc);
static void update_router_have_minimum_dir_info(void);
static const char *signed_descriptor_get_body_impl(signed_descriptor_t *desc,
@@ -4332,8 +4330,8 @@ update_router_descriptor_cache_downloads_v2(time_t now)
/** For any descriptor that we want that's currently listed in
* <b>consensus</b>, download it as appropriate. */
static void
update_consensus_router_descriptor_downloads(time_t now,
void
update_consensus_router_descriptor_downloads(time_t now, int is_vote,
networkstatus_t *consensus)
{
or_options_t *options = get_options();
@@ -4351,8 +4349,10 @@ update_consensus_router_descriptor_downloads(time_t now,
map = digestmap_new();
list_pending_descriptor_downloads(map, 0);
SMARTLIST_FOREACH(consensus->routerstatus_list, routerstatus_t *, rs,
SMARTLIST_FOREACH(consensus->routerstatus_list, void *, rsp,
{
routerstatus_t *rs =
is_vote ? &(((vote_routerstatus_t *)rsp)->status) : rsp;
signed_descriptor_t *sd;
if ((sd = router_get_by_descriptor_digest(rs->descriptor_digest))) {
routerinfo_t *ri;
@@ -4445,7 +4445,7 @@ update_router_descriptor_downloads(time_t now)
if (directory_fetches_dir_info_early(options)) {
update_router_descriptor_cache_downloads_v2(now);
}
update_consensus_router_descriptor_downloads(now,
update_consensus_router_descriptor_downloads(now, 0,
networkstatus_get_reasonably_live_consensus(now));
/* XXXX021 we could be smarter here; see notes on bug 652. */