aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/dirauth/dirvote.c4
-rw-r--r--src/or/dirauth/dirvote.h1
-rw-r--r--src/or/networkstatus.c3
-rw-r--r--src/or/voting_schedule.c6
-rw-r--r--src/or/voting_schedule.h3
6 files changed, 11 insertions, 9 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 2b35138b6e..a2b84991a0 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -104,6 +104,7 @@
#include "statefile.h"
#include "transports.h"
#include "ext_orport.h"
+#include "voting_schedule.h"
#ifdef _WIN32
#include <shlobj.h>
#endif
@@ -2359,7 +2360,7 @@ options_act(const or_options_t *old_options)
/* We may need to reschedule some directory stuff if our status changed. */
if (old_options) {
if (options_transition_affects_dirauth_timing(old_options, options)) {
- dirvote_recalculate_timing(options, time(NULL));
+ voting_schedule_recalculate_timing(options, time(NULL));
reschedule_dirvote(options);
}
if (!bool_eq(directory_fetches_dir_info_early(options),
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index b67b78cbb9..6b7114b141 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -2768,7 +2768,7 @@ dirvote_act(const or_options_t *options, time_t now)
"Mine is %s.",
keys, hex_str(c->cache_info.identity_digest, DIGEST_LEN));
tor_free(keys);
- dirvote_recalculate_timing(options, now);
+ voting_schedule_recalculate_timing(options, now);
}
#define IF_TIME_FOR_NEXT_ACTION(when_field, done_field) \
@@ -2814,7 +2814,7 @@ dirvote_act(const or_options_t *options, time_t now)
networkstatus_get_latest_consensus_by_flavor(FLAV_NS));
/* XXXX We will want to try again later if we haven't got enough
* signatures yet. Implement this if it turns out to ever happen. */
- dirvote_recalculate_timing(options, now);
+ voting_schedule_recalculate_timing(options, now);
return voting_schedule.voting_starts;
} ENDIF
diff --git a/src/or/dirauth/dirvote.h b/src/or/dirauth/dirvote.h
index 7294962925..228121268f 100644
--- a/src/or/dirauth/dirvote.h
+++ b/src/or/dirauth/dirvote.h
@@ -178,7 +178,6 @@ dirvote_add_signatures(const char *detached_signatures_body, const char *source,
#endif /* HAVE_MODULE_DIRAUTH */
-void dirvote_recalculate_timing(const or_options_t *options, time_t now);
/* Item access */
MOCK_DECL(const char*, dirvote_get_pending_consensus,
(consensus_flavor_t flav));
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 99f1490203..ac3e94e884 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -67,6 +67,7 @@
#include "transports.h"
#include "torcert.h"
#include "channelpadding.h"
+#include "voting_schedule.h"
#include "dirauth/dirvote.h"
@@ -2014,7 +2015,7 @@ networkstatus_set_current_consensus(const char *consensus,
* the first thing we need to do is recalculate the voting schedule static
* object so we can use the timings in there needed by some subsystems
* such as hidden service and shared random. */
- dirvote_recalculate_timing(options, now);
+ voting_schedule_recalculate_timing(options, now);
reschedule_dirvote(options);
nodelist_set_consensus(c);
diff --git a/src/or/voting_schedule.c b/src/or/voting_schedule.c
index 88415993cc..b7676d5e79 100644
--- a/src/or/voting_schedule.c
+++ b/src/or/voting_schedule.c
@@ -15,8 +15,6 @@
#include "config.h"
#include "networkstatus.h"
-#include "dirauth/dirvote.h"
-
/* =====
* Vote scheduling
* ===== */
@@ -143,7 +141,7 @@ voting_schedule_get_next_valid_after_time(void)
* voting schedule can lead to bugs. */
if (tor_mem_is_zero((const char *) &voting_schedule,
sizeof(voting_schedule))) {
- dirvote_recalculate_timing(get_options(), time(NULL));
+ voting_schedule_recalculate_timing(get_options(), time(NULL));
voting_schedule.created_on_demand = 1;
}
return voting_schedule.interval_starts;
@@ -153,7 +151,7 @@ voting_schedule_get_next_valid_after_time(void)
* doing. All type of tor do that because HS subsystem needs the timing as
* well to function properly. */
void
-dirvote_recalculate_timing(const or_options_t *options, time_t now)
+voting_schedule_recalculate_timing(const or_options_t *options, time_t now)
{
voting_schedule_t *new_voting_schedule;
diff --git a/src/or/voting_schedule.h b/src/or/voting_schedule.h
index cd45914db6..4f9d584031 100644
--- a/src/or/voting_schedule.h
+++ b/src/or/voting_schedule.h
@@ -49,6 +49,9 @@ typedef struct {
extern voting_schedule_t voting_schedule;
+void voting_schedule_recalculate_timing(const or_options_t *options,
+ time_t now);
+
time_t voting_schedule_get_start_of_next_interval(time_t now,
int interval,
int offset);