diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-08-15 19:55:52 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-08-15 19:55:52 +0000 |
commit | 4135c68853a92cf756886d3baf303a7c58ee8aaf (patch) | |
tree | 33db95470c297a6ce490af9e5d8353cab11ea9be /src/or/dirvote.c | |
parent | 717f3b8a1239fe1e72afd76002470969730cd2bc (diff) | |
download | tor-4135c68853a92cf756886d3baf303a7c58ee8aaf.tar.gz tor-4135c68853a92cf756886d3baf303a7c58ee8aaf.zip |
r14049@Kushana: nickm | 2007-08-15 14:43:56 -0400
Implement code to serve pending votes, consensuses, and signatures.
svn:r11125
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r-- | src/or/dirvote.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 5d04713754..2c88b07c9a 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1096,7 +1096,6 @@ dirvote_recalculate_timing(time_t now) memset(&voting_schedule, 0, sizeof(voting_schedule)); if (consensus) { - /* XXXX020 sanity-check these somewhere! */ interval = consensus->fresh_until - consensus->valid_after; vote_delay = consensus->vote_seconds; dist_delay = consensus->dist_seconds; @@ -1605,3 +1604,40 @@ dirvote_free_all(void) } } +/* ==== + * Access to pending items. + * ==== */ + +/** DOCDOC */ +const char * +dirvote_get_pending_consensus(void) +{ + return pending_consensus_body; +} + +/** DOCDOC */ +const char * +dirvote_get_pending_detached_signatures(void) +{ + return pending_consensus_signatures; +} + +/** DOCDOC */ +const cached_dir_t * +dirvote_get_vote(const char *id) +{ + if (!pending_vote_list) + return NULL; + if (id == NULL) { + authority_cert_t *c = get_my_v3_authority_cert(); + if (c) + id = c->cache_info.identity_digest; + else + return NULL; + } + SMARTLIST_FOREACH(pending_vote_list, pending_vote_t *, pv, + if (!memcmp(get_voter(pv->vote)->identity_digest, id, DIGEST_LEN)) + return pv->vote_body); + return NULL; +} + |