diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-15 14:59:48 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-15 14:59:48 +0000 |
commit | 161b85d588b8ca3cffe708c07d9216d8355fbf1e (patch) | |
tree | 078ac2aaa9c42e7ba1d1c4ddb0f64ada4e294ab1 /src | |
parent | c8ad4f58eed825f05309aa186b538e94a53ae472 (diff) | |
download | tor-161b85d588b8ca3cffe708c07d9216d8355fbf1e.tar tor-161b85d588b8ca3cffe708c07d9216d8355fbf1e.tar.gz |
r15781@catbus: nickm | 2007-10-15 10:59:26 -0400
Make discard_old_votes part of the consensus publishing process, so we conform to spec, and so we avoid a weird bugs where publishing sets the consensus, setting the consensus makes us reschedule, and rescheduling makes us delay vote-discarding.
svn:r11944
Diffstat (limited to 'src')
-rw-r--r-- | src/or/dirvote.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 46266e0ad..cd9cfac53 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1043,8 +1043,6 @@ static struct { time_t fetch_missing_signatures; /** When do we publish the consensus? */ time_t interval_starts; - /** When do we discard old votes and pending detached signatures? */ - time_t discard_old_votes; /* True iff we have generated and distributed our vote. */ int have_voted; @@ -1056,7 +1054,7 @@ static struct { int have_fetched_missing_signatures; /* True iff we have published our consensus. */ int have_published_consensus; -} voting_schedule = {0,0,0,0,0,0,0,0,0,0,0}; +} voting_schedule = {0,0,0,0,0,0,0,0,0,0}; /** Set voting_schedule to hold the timing for the next vote we should be * doing. */ @@ -1094,8 +1092,6 @@ dirvote_recalculate_timing(time_t now) voting_schedule.voting_ends = start - dist_delay; voting_schedule.fetch_missing_votes = start - dist_delay - (vote_delay/2); voting_schedule.voting_starts = start - dist_delay - vote_delay; - - voting_schedule.discard_old_votes = start; } /** Entry point: Take whatever voting actions are pending as of <b>now</b>. */ @@ -1138,16 +1134,13 @@ dirvote_act(time_t now) } if (voting_schedule.interval_starts < now && !voting_schedule.have_published_consensus) { - log_notice(LD_DIR, "Time to publish the consensus."); + log_notice(LD_DIR, "Time to publish the consensus and discard old votes"); dirvote_publish_consensus(); + dirvote_clear_votes(0); /* XXXX020 we will want to try again later if we haven't got enough * signatures yet. */ - voting_schedule.have_published_consensus = 1; - } - if (voting_schedule.discard_old_votes < now) { - log_notice(LD_DIR, "Time to discard old votes."); - dirvote_clear_votes(0); dirvote_recalculate_timing(now); + voting_schedule.have_published_consensus = 1; } } |