summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-25 20:01:09 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-27 21:40:12 -0400
commit7b8d48a6cb1109a5cd16e4db7b088a968b0186e3 (patch)
tree62014702bea46f67dc664db31860eadf16a44551 /src/or/main.c
parentfba8d7b222bf00cf2812362072e913c26a41b370 (diff)
downloadtor-7b8d48a6cb1109a5cd16e4db7b088a968b0186e3.tar.gz
tor-7b8d48a6cb1109a5cd16e4db7b088a968b0186e3.zip
Clean the consdiffmgr cache and launch new diffs as needed.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 452c350fbe..0da43dc232 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. */