mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
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>
This commit is contained in:
parent
711ff6cdf7
commit
e504b1b358
6 changed files with 18 additions and 17 deletions
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue