summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-10-09 20:44:51 +0000
committerNick Mathewson <nickm@torproject.org>2007-10-09 20:44:51 +0000
commit97fa3fdf1623a89506b644d352b9682a1e1a5f01 (patch)
treeee29d546531c2e43f0941dd60a4148bc802f994d /src/or/dirserv.c
parent8b71a76dd322ab0043871cac3c299cd660471121 (diff)
downloadtor-97fa3fdf1623a89506b644d352b9682a1e1a5f01.tar.gz
tor-97fa3fdf1623a89506b644d352b9682a1e1a5f01.zip
r15599@catbus: nickm | 2007-10-09 16:44:36 -0400
Fix the bug that was making moria1 set valid-after wrong in its votes: we were looking at the preferred timing when we should have been looking at the consensus timing. svn:r11818
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index b2ec0c3cfe..08d5318ed6 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2017,8 +2017,18 @@ generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
v3_out->is_vote = 1;
dirvote_get_preferred_voting_intervals(&timing);
v3_out->published = now;
- v3_out->valid_after =
- dirvote_get_start_of_next_interval(now, timing.vote_interval);
+ {
+ networkstatus_vote_t *current_consensus =
+ networkstatus_get_live_consensus(now);
+ time_t consensus_interval;
+ if (current_consensus)
+ consensus_interval = current_consensus->fresh_until -
+ current_consensus->valid_after;
+ else
+ consensus_interval = timing.vote_interval;
+ v3_out->valid_after =
+ dirvote_get_start_of_next_interval(now, consensus_interval);
+ }
v3_out->fresh_until = v3_out->valid_after + timing.vote_interval;
v3_out->valid_until = v3_out->valid_after +
(timing.vote_interval * timing.n_intervals_valid);