aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirvote.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2016-05-03 10:18:45 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-06-20 15:26:58 -0400
commitb3b4ffce2e23bfb6a2af374cd8bfa5981628a342 (patch)
tree69f8d91ec6966e850a789600cfc1eb4e33fbb7c2 /src/or/dirvote.h
parent9744a40f7aa71f874b9f3eeb3c5e7d0899c8d409 (diff)
downloadtor-b3b4ffce2e23bfb6a2af374cd8bfa5981628a342.tar.gz
tor-b3b4ffce2e23bfb6a2af374cd8bfa5981628a342.zip
prop250: Add memory and disk state in new files
This commit introduces two new files with their header. "shared_random.c" contains basic functions to initialize the state and allow commit decoding for the disk state to be able to parse them from disk. "shared_random_state.c" contains everything that has to do with the state for both our memory and disk. Lots of helper functions as well as a mechanism to query the state in a synchronized way. Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/or/dirvote.h')
-rw-r--r--src/or/dirvote.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index 0b1d284060..f2080a522e 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -121,12 +121,44 @@ void ns_detached_signatures_free(ns_detached_signatures_t *s);
authority_cert_t *authority_cert_dup(authority_cert_t *cert);
/* vote scheduling */
+
+/** Scheduling information for a voting interval. */
+typedef struct {
+ /** When do we generate and distribute our vote for this interval? */
+ time_t voting_starts;
+ /** When do we send an HTTP request for any votes that we haven't
+ * been posted yet?*/
+ time_t fetch_missing_votes;
+ /** When do we give up on getting more votes and generate a consensus? */
+ time_t voting_ends;
+ /** When do we send an HTTP request for any signatures we're expecting to
+ * see on the consensus? */
+ time_t fetch_missing_signatures;
+ /** When do we publish the consensus? */
+ time_t interval_starts;
+
+ /* True iff we have generated and distributed our vote. */
+ int have_voted;
+ /* True iff we've requested missing votes. */
+ int have_fetched_missing_votes;
+ /* True iff we have built a consensus and sent the signatures around. */
+ int have_built_consensus;
+ /* True iff we've fetched missing signatures. */
+ int have_fetched_missing_signatures;
+ /* True iff we have published our consensus. */
+ int have_published_consensus;
+} voting_schedule_t;
+
+voting_schedule_t *get_voting_schedule(const or_options_t *options,
+ time_t now, int severity);
+
void dirvote_get_preferred_voting_intervals(vote_timing_t *timing_out);
time_t dirvote_get_start_of_next_interval(time_t now,
int interval,
int offset);
void dirvote_recalculate_timing(const or_options_t *options, time_t now);
void dirvote_act(const or_options_t *options, time_t now);
+time_t get_next_valid_after_time(time_t now);
/* invoked on timers and by outside triggers. */
struct pending_vote_t * dirvote_add_vote(const char *vote_body,