Macros | Functions | Variables
voting_schedule.c File Reference
#include "feature/dircommon/voting_schedule.h"
#include "core/or/or.h"
#include "app/config/config.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/networkstatus_st.h"

Go to the source code of this file.


#define voting_schedule_free(s)   FREE_AND_NULL(voting_schedule_t, voting_schedule_free_, (s))


time_t voting_schedule_get_start_of_next_interval (time_t now, int interval, int offset)
static voting_schedule_tget_voting_schedule (const or_options_t *options, time_t now, int severity)
static void voting_schedule_free_ (voting_schedule_t *voting_schedule_to_free)
time_t voting_schedule_get_next_valid_after_time (void)
void voting_schedule_recalculate_timing (const or_options_t *options, time_t now)


voting_schedule_t voting_schedule

Detailed Description

This file contains functions that are from the directory authority subsystem related to voting specifically but used by many part of tor. The full feature is built as part of the dirauth module.

Definition in file voting_schedule.c.

Function Documentation

◆ voting_schedule_free_()

static void voting_schedule_free_ ( voting_schedule_t voting_schedule_to_free)

Frees a voting_schedule_t. This should be used instead of the generic tor_free.

Definition at line 134 of file voting_schedule.c.

References tor_free.

◆ voting_schedule_get_start_of_next_interval()

time_t voting_schedule_get_start_of_next_interval ( time_t  now,
int  interval,
int  offset 

Return the start of the next interval of size interval (in seconds) after now, plus offset. Midnight always starts a fresh interval, and if the last interval of a day would be truncated to less than half its size, it is rolled into the previous interval.

Definition at line 30 of file voting_schedule.c.

References tor_gmtime_r(), and tor_timegm().

◆ voting_schedule_recalculate_timing()

void voting_schedule_recalculate_timing ( const or_options_t options,
time_t  now 

Set voting_schedule to hold the timing for the next vote we should be doing. All type of tor do that because HS subsystem needs the timing as well to function properly.

Definition at line 182 of file voting_schedule.c.