mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 23:21:38 +01:00
Clean the consdiffmgr cache and launch new diffs as needed.
This commit is contained in:
parent
fba8d7b222
commit
7b8d48a6cb
1 changed files with 19 additions and 0 deletions
|
@ -1186,6 +1186,7 @@ CALLBACK(check_dns_honesty);
|
||||||
CALLBACK(write_bridge_ns);
|
CALLBACK(write_bridge_ns);
|
||||||
CALLBACK(check_fw_helper_app);
|
CALLBACK(check_fw_helper_app);
|
||||||
CALLBACK(heartbeat);
|
CALLBACK(heartbeat);
|
||||||
|
CALLBACK(clean_consdiffmgr);
|
||||||
|
|
||||||
#undef CALLBACK
|
#undef CALLBACK
|
||||||
|
|
||||||
|
@ -1218,6 +1219,7 @@ static periodic_event_item_t periodic_events[] = {
|
||||||
CALLBACK(write_bridge_ns),
|
CALLBACK(write_bridge_ns),
|
||||||
CALLBACK(check_fw_helper_app),
|
CALLBACK(check_fw_helper_app),
|
||||||
CALLBACK(heartbeat),
|
CALLBACK(heartbeat),
|
||||||
|
CALLBACK(clean_consdiffmgr),
|
||||||
END_OF_PERIODIC_EVENTS
|
END_OF_PERIODIC_EVENTS
|
||||||
};
|
};
|
||||||
#undef CALLBACK
|
#undef CALLBACK
|
||||||
|
@ -1473,6 +1475,12 @@ run_scheduled_events(time_t now)
|
||||||
/* 11b. check pending unconfigured managed proxies */
|
/* 11b. check pending unconfigured managed proxies */
|
||||||
if (!net_is_disabled() && pt_proxies_configuration_pending())
|
if (!net_is_disabled() && pt_proxies_configuration_pending())
|
||||||
pt_configure_remaining_proxies();
|
pt_configure_remaining_proxies();
|
||||||
|
|
||||||
|
/* 12. launch diff computations. (This is free if there are none to
|
||||||
|
* launch.) */
|
||||||
|
if (server_mode(options)) {
|
||||||
|
consdiffmgr_rescan();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Periodic callback: rotate the onion keys after the period defined by the
|
/* Periodic callback: rotate the onion keys after the period defined by the
|
||||||
|
@ -2036,6 +2044,17 @@ heartbeat_callback(time_t now, const or_options_t *options)
|
||||||
return options->HeartbeatPeriod;
|
return options->HeartbeatPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CDM_CLEAN_CALLBACK_INTERVAL 600
|
||||||
|
static int
|
||||||
|
clean_consdiffmgr_callback(time_t now, const or_options_t *options)
|
||||||
|
{
|
||||||
|
(void)now;
|
||||||
|
if (server_mode(options)) {
|
||||||
|
consdiffmgr_cleanup();
|
||||||
|
}
|
||||||
|
return CDM_CLEAN_CALLBACK_INTERVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/** Timer: used to invoke second_elapsed_callback() once per second. */
|
/** Timer: used to invoke second_elapsed_callback() once per second. */
|
||||||
static periodic_timer_t *second_timer = NULL;
|
static periodic_timer_t *second_timer = NULL;
|
||||||
/** Number of libevent errors in the last second: we die if we get too many. */
|
/** Number of libevent errors in the last second: we die if we get too many. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue