[tor-commits] [tor/master] Clean the consdiffmgr cache and launch new diffs as needed.
nickm at torproject.org
nickm at torproject.org
Fri Apr 28 15:08:22 UTC 2017
commit 7b8d48a6cb1109a5cd16e4db7b088a968b0186e3
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Apr 25 20:01:09 2017 -0400
Clean the consdiffmgr cache and launch new diffs as needed.
---
src/or/main.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/or/main.c b/src/or/main.c
index 452c350..0da43dc 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1186,6 +1186,7 @@ CALLBACK(check_dns_honesty);
CALLBACK(write_bridge_ns);
CALLBACK(check_fw_helper_app);
CALLBACK(heartbeat);
+CALLBACK(clean_consdiffmgr);
#undef CALLBACK
@@ -1218,6 +1219,7 @@ static periodic_event_item_t periodic_events[] = {
CALLBACK(write_bridge_ns),
CALLBACK(check_fw_helper_app),
CALLBACK(heartbeat),
+ CALLBACK(clean_consdiffmgr),
END_OF_PERIODIC_EVENTS
};
#undef CALLBACK
@@ -1473,6 +1475,12 @@ run_scheduled_events(time_t now)
/* 11b. check pending unconfigured managed proxies */
if (!net_is_disabled() && pt_proxies_configuration_pending())
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
@@ -2036,6 +2044,17 @@ heartbeat_callback(time_t now, const or_options_t *options)
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. */
static periodic_timer_t *second_timer = NULL;
/** Number of libevent errors in the last second: we die if we get too many. */
More information about the tor-commits
mailing list