[tor-commits] [tor/master] dirvote: Move code. No behavior change

nickm at torproject.org nickm at torproject.org
Tue Nov 7 14:58:59 UTC 2017


commit 60164f057c4ac5471754f0326ab631448cd7c120
Author: David Goulet <dgoulet at torproject.org>
Date:   Fri Oct 27 09:13:43 2017 -0400

    dirvote: Move code. No behavior change
    
    Needed for next commit to address #23623.
    
    Signed-off-by: David Goulet <dgoulet at torproject.org>
---
 src/or/dirvote.c | 76 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index ba0ab7a77..ddaadb387 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -2787,44 +2787,6 @@ dirvote_get_start_of_next_interval(time_t now, int interval, int offset)
   return next;
 }
 
-/* Using the time <b>now</b>, return the next voting valid-after time. */
-time_t
-get_next_valid_after_time(time_t now)
-{
-  time_t next_valid_after_time;
-  const or_options_t *options = get_options();
-  voting_schedule_t *new_voting_schedule =
-    get_voting_schedule(options, now, LOG_INFO);
-  tor_assert(new_voting_schedule);
-
-  next_valid_after_time = new_voting_schedule->interval_starts;
-  voting_schedule_free(new_voting_schedule);
-
-  return next_valid_after_time;
-}
-
-static voting_schedule_t voting_schedule;
-
-/** Set voting_schedule to hold the timing for the next vote we should be
- * doing. */
-void
-dirvote_recalculate_timing(const or_options_t *options, time_t now)
-{
-  voting_schedule_t *new_voting_schedule;
-
-  if (!authdir_mode_v3(options)) {
-    return;
-  }
-
-  /* get the new voting schedule */
-  new_voting_schedule = get_voting_schedule(options, now, LOG_NOTICE);
-  tor_assert(new_voting_schedule);
-
-  /* Fill in the global static struct now */
-  memcpy(&voting_schedule, new_voting_schedule, sizeof(voting_schedule));
-  voting_schedule_free(new_voting_schedule);
-}
-
 /* Populate and return a new voting_schedule_t that can be used to schedule
  * voting. The object is allocated on the heap and it's the responsibility of
  * the caller to free it. Can't fail. */
@@ -2891,6 +2853,44 @@ voting_schedule_free(voting_schedule_t *voting_schedule_to_free)
   tor_free(voting_schedule_to_free);
 }
 
+static voting_schedule_t voting_schedule;
+
+/* Using the time <b>now</b>, return the next voting valid-after time. */
+time_t
+get_next_valid_after_time(time_t now)
+{
+  time_t next_valid_after_time;
+  const or_options_t *options = get_options();
+  voting_schedule_t *new_voting_schedule =
+    get_voting_schedule(options, now, LOG_INFO);
+  tor_assert(new_voting_schedule);
+
+  next_valid_after_time = new_voting_schedule->interval_starts;
+  voting_schedule_free(new_voting_schedule);
+
+  return next_valid_after_time;
+}
+
+/** Set voting_schedule to hold the timing for the next vote we should be
+ * doing. */
+void
+dirvote_recalculate_timing(const or_options_t *options, time_t now)
+{
+  voting_schedule_t *new_voting_schedule;
+
+  if (!authdir_mode_v3(options)) {
+    return;
+  }
+
+  /* get the new voting schedule */
+  new_voting_schedule = get_voting_schedule(options, now, LOG_NOTICE);
+  tor_assert(new_voting_schedule);
+
+  /* Fill in the global static struct now */
+  memcpy(&voting_schedule, new_voting_schedule, sizeof(voting_schedule));
+  voting_schedule_free(new_voting_schedule);
+}
+
 /** Entry point: Take whatever voting actions are pending as of <b>now</b>. */
 void
 dirvote_act(const or_options_t *options, time_t now)





More information about the tor-commits mailing list