diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-27 09:55:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-05-01 10:54:54 -0400 |
commit | 234e317ef17de111a48c8bb6dba9e84d346afe25 (patch) | |
tree | 2f41990ba2270608ea281923fadb775551368836 /src/or/main.c | |
parent | 6868398b69f9651ad4d15892f19470500ef031d3 (diff) | |
download | tor-234e317ef17de111a48c8bb6dba9e84d346afe25.tar.gz tor-234e317ef17de111a48c8bb6dba9e84d346afe25.zip |
Ensure that voting is rescheduled whenever the schedule changes.
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c index 8bc89817a4..0708e647f1 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1436,6 +1436,7 @@ STATIC periodic_event_item_t periodic_events[] = { * can access them by name. We also keep them inside periodic_events[] * so that we can implement "reset all timers" in a reasonable way. */ static periodic_event_item_t *check_descriptor_event=NULL; +static periodic_event_item_t *dirvote_event=NULL; static periodic_event_item_t *fetch_networkstatus_event=NULL; static periodic_event_item_t *launch_descriptor_fetches_event=NULL; static periodic_event_item_t *check_dns_honesty_event=NULL; @@ -1535,6 +1536,7 @@ initialize_periodic_events(void) STMT_BEGIN name ## _event = find_periodic_event( #name ); STMT_END NAMED_CALLBACK(check_descriptor); + NAMED_CALLBACK(dirvote); NAMED_CALLBACK(fetch_networkstatus); NAMED_CALLBACK(launch_descriptor_fetches); NAMED_CALLBACK(check_dns_honesty); @@ -2001,6 +2003,16 @@ dirvote_callback(time_t now, const or_options_t *options) } } +/** Reschedule the directory-authority voting event. Run this whenever the + * schedule has changed. */ +void +reschedule_dirvote(const or_options_t *options) +{ + if (periodic_events_initialized && authdir_mode_v3(options)) { + periodic_event_reschedule(dirvote_event); + } +} + /** * Periodic callback: If our consensus is too old, recalculate whether * we can actually use it. |