[or-cvs] r11818: Fix the bug that was making moria1 set valid-after wrong in (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue Oct 9 20:44:52 UTC 2007


Author: nickm
Date: 2007-10-09 16:44:51 -0400 (Tue, 09 Oct 2007)
New Revision: 11818

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/dirserv.c
Log:
 r15599 at 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.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15599] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-09 20:44:47 UTC (rev 11817)
+++ tor/trunk/ChangeLog	2007-10-09 20:44:51 UTC (rev 11818)
@@ -40,6 +40,8 @@
       gets rid of annoying "400 OK" log messages, which may have been masking
       some deeper issue.  Bugfix on 0.2.0.7-alpha.
     - When we get a valid consensus, recompute the voting schedule.
+    - Base the valid-after time of a vote on the consensus voting schedule,
+      not on our preferred schedule.
 
   o Minor bugfixes (performance):
     - Use a slightly simpler string hashing algorithm (copying Python's

Modified: tor/trunk/src/or/dirserv.c
===================================================================
--- tor/trunk/src/or/dirserv.c	2007-10-09 20:44:47 UTC (rev 11817)
+++ tor/trunk/src/or/dirserv.c	2007-10-09 20:44:51 UTC (rev 11818)
@@ -2017,8 +2017,18 @@
   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);



More information about the tor-commits mailing list