[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] vote: Namespace functions in voting_schedule.c



commit e504b1b35831e9d18be7b89ab471705b41092606
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue May 1 11:18:44 2018 -0400

    vote: Namespace functions in voting_schedule.c
    
    Rename them from dirvote_* to voting_schedule_*.
    
    No code behavior change.
    
    Part of #25988
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/or/dirauth/dirvote.c             |  5 +++--
 src/or/dirauth/shared_random.c       |  2 +-
 src/or/dirauth/shared_random_state.c |  2 +-
 src/or/shared_random_common.c        |  4 ++--
 src/or/voting_schedule.c             | 11 +++++++----
 src/or/voting_schedule.h             | 11 ++++-------
 6 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 1d8124413..b67b78cbb 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -4441,8 +4441,9 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
     else
       last_consensus_interval = options->TestingV3AuthInitialVotingInterval;
     v3_out->valid_after =
-      dirvote_get_start_of_next_interval(now, (int)last_consensus_interval,
-                                         options->TestingV3AuthVotingStartOffset);
+      voting_schedule_get_start_of_next_interval(now,
+                                   (int)last_consensus_interval,
+                                   options->TestingV3AuthVotingStartOffset);
     format_iso_time(tbuf, v3_out->valid_after);
     log_notice(LD_DIR,"Choosing valid-after time in vote as %s: "
                "consensus_set=%d, last_interval=%d",
diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c
index fcf134aa4..c14932893 100644
--- a/src/or/dirauth/shared_random.c
+++ b/src/or/dirauth/shared_random.c
@@ -1252,7 +1252,7 @@ sr_act_post_consensus(const networkstatus_t *consensus)
   }
 
   /* Prepare our state so that it's ready for the next voting period. */
-  sr_state_update(dirvote_get_next_valid_after_time());
+  sr_state_update(voting_schedule_get_next_valid_after_time());
 }
 
 /* Initialize shared random subsystem. This MUST be called early in the boot
diff --git a/src/or/dirauth/shared_random_state.c b/src/or/dirauth/shared_random_state.c
index 6b915abcf..ef5a27ee5 100644
--- a/src/or/dirauth/shared_random_state.c
+++ b/src/or/dirauth/shared_random_state.c
@@ -1293,7 +1293,7 @@ sr_state_init(int save_to_disk, int read_from_disk)
   /* We have a state in memory, let's make sure it's updated for the current
    * and next voting round. */
   {
-    time_t valid_after = dirvote_get_next_valid_after_time();
+    time_t valid_after = voting_schedule_get_next_valid_after_time();
     sr_state_update(valid_after);
   }
   return 0;
diff --git a/src/or/shared_random_common.c b/src/or/shared_random_common.c
index 810b8b377..9d47e3a49 100644
--- a/src/or/shared_random_common.c
+++ b/src/or/shared_random_common.c
@@ -59,10 +59,10 @@ get_start_time_of_current_round(void)
   const or_options_t *options = get_options();
   int voting_interval = get_voting_interval();
   /* First, get the start time of the next round */
-  time_t next_start = dirvote_get_next_valid_after_time();
+  time_t next_start = voting_schedule_get_next_valid_after_time();
   /* Now roll back next_start by a voting interval to find the start time of
      the current round. */
-  time_t curr_start = dirvote_get_start_of_next_interval(
+  time_t curr_start = voting_schedule_get_start_of_next_interval(
                                      next_start - voting_interval - 1,
                                      voting_interval,
                                      options->TestingV3AuthVotingStartOffset);
diff --git a/src/or/voting_schedule.c b/src/or/voting_schedule.c
index 9725a3273..88415993c 100644
--- a/src/or/voting_schedule.c
+++ b/src/or/voting_schedule.c
@@ -15,6 +15,8 @@
 #include "config.h"
 #include "networkstatus.h"
 
+#include "dirauth/dirvote.h"
+
 /* =====
  * Vote scheduling
  * ===== */
@@ -25,7 +27,8 @@
  * truncated to less than half its size, it is rolled into the
  * previous interval. */
 time_t
-dirvote_get_start_of_next_interval(time_t now, int interval, int offset)
+voting_schedule_get_start_of_next_interval(time_t now, int interval,
+                                           int offset)
 {
   struct tm tm;
   time_t midnight_today=0;
@@ -92,9 +95,9 @@ get_voting_schedule(const or_options_t *options, time_t now, int severity)
     vote_delay = dist_delay = interval / 4;
 
   start = new_voting_schedule->interval_starts =
-    dirvote_get_start_of_next_interval(now,interval,
+    voting_schedule_get_start_of_next_interval(now,interval,
                                       options->TestingV3AuthVotingStartOffset);
-  end = dirvote_get_start_of_next_interval(start+1, interval,
+  end = voting_schedule_get_start_of_next_interval(start+1, interval,
                                       options->TestingV3AuthVotingStartOffset);
 
   tor_assert(end > start);
@@ -133,7 +136,7 @@ voting_schedule_t voting_schedule;
 
 /* Using the time <b>now</b>, return the next voting valid-after time. */
 time_t
-dirvote_get_next_valid_after_time(void)
+voting_schedule_get_next_valid_after_time(void)
 {
   /* This is a safe guard in order to make sure that the voting schedule
    * static object is at least initialized. Using this function with a zeroed
diff --git a/src/or/voting_schedule.h b/src/or/voting_schedule.h
index b7c7f7ea9..cd45914db 100644
--- a/src/or/voting_schedule.h
+++ b/src/or/voting_schedule.h
@@ -11,9 +11,6 @@
 
 #include "or.h"
 
-/* Dirauth module. */
-#include "dirauth/dirvote.h"
-
 /** Scheduling information for a voting interval. */
 typedef struct {
   /** When do we generate and distribute our vote for this interval? */
@@ -52,10 +49,10 @@ typedef struct {
 
 extern voting_schedule_t voting_schedule;
 
-time_t dirvote_get_start_of_next_interval(time_t now,
-                                          int interval,
-                                          int offset);
-time_t dirvote_get_next_valid_after_time(void);
+time_t voting_schedule_get_start_of_next_interval(time_t now,
+                                                  int interval,
+                                                  int offset);
+time_t voting_schedule_get_next_valid_after_time(void);
 
 #endif /* TOR_VOTING_SCHEDULE_H */
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits