mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Introduce vanguards-lite subsystem and some of its entry points
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
This commit is contained in:
@@ -1293,6 +1293,7 @@ signewnym_impl(time_t now)
|
||||
circuit_mark_all_dirty_circs_as_unusable();
|
||||
addressmap_clear_transient();
|
||||
hs_client_purge_state();
|
||||
purge_vanguards_lite();
|
||||
time_of_last_signewnym = now;
|
||||
signewnym_is_pending = 0;
|
||||
|
||||
@@ -1370,6 +1371,7 @@ CALLBACK(save_state);
|
||||
CALLBACK(write_stats_file);
|
||||
CALLBACK(control_per_second_events);
|
||||
CALLBACK(second_elapsed);
|
||||
CALLBACK(manage_vglite);
|
||||
|
||||
#undef CALLBACK
|
||||
|
||||
@@ -1392,6 +1394,9 @@ STATIC periodic_event_item_t mainloop_periodic_events[] = {
|
||||
CALLBACK(second_elapsed, NET_PARTICIPANT,
|
||||
FL(RUN_ON_DISABLE)),
|
||||
|
||||
/* Update vanguards-lite once per hour, if we have networking */
|
||||
CALLBACK(manage_vglite, NET_PARTICIPANT, FL(NEED_NET)),
|
||||
|
||||
/* XXXX Do we have a reason to do this on a callback? Does it do any good at
|
||||
* all? For now, if we're dormant, we can let our listeners decay. */
|
||||
CALLBACK(retry_listeners, NET_PARTICIPANT, FL(NEED_NET)),
|
||||
@@ -1662,6 +1667,21 @@ mainloop_schedule_shutdown(int delay_sec)
|
||||
mainloop_event_schedule(scheduled_shutdown_ev, &delay_tv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update vanguards-lite layer2 nodes, once per hour
|
||||
*/
|
||||
static int
|
||||
manage_vglite_callback(time_t now, const or_options_t *options)
|
||||
{
|
||||
(void)now;
|
||||
(void)options;
|
||||
#define VANGUARDS_LITE_INTERVAL (60*60)
|
||||
|
||||
maintain_layer2_guards();
|
||||
|
||||
return VANGUARDS_LITE_INTERVAL;
|
||||
}
|
||||
|
||||
/** Perform regular maintenance tasks. This function gets run once per
|
||||
* second.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user