diff options
author | David Goulet <dgoulet@torproject.org> | 2018-05-01 11:18:44 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-05-01 11:43:23 -0400 |
commit | e504b1b35831e9d18be7b89ab471705b41092606 (patch) | |
tree | acedbc4aa31c84266cfe4f6b98a8b85b95c977f1 | |
parent | 711ff6cdf79c32921f587d389b6ac25630a39d80 (diff) | |
download | tor-e504b1b35831e9d18be7b89ab471705b41092606.tar.gz tor-e504b1b35831e9d18be7b89ab471705b41092606.zip |
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@torproject.org>
-rw-r--r-- | src/or/dirauth/dirvote.c | 5 | ||||
-rw-r--r-- | src/or/dirauth/shared_random.c | 2 | ||||
-rw-r--r-- | src/or/dirauth/shared_random_state.c | 2 | ||||
-rw-r--r-- | src/or/shared_random_common.c | 4 | ||||
-rw-r--r-- | src/or/voting_schedule.c | 11 | ||||
-rw-r--r-- | 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 1d81244137..b67b78cbb9 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 fcf134aa42..c149328935 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 6b915abcf5..ef5a27ee58 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 810b8b377a..9d47e3a49e 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 9725a32737..88415993cc 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 b7c7f7ea93..cd45914db6 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 */ |