summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2016-06-21 15:05:59 +0300
committerNick Mathewson <nickm@torproject.org>2016-06-21 08:54:30 -0400
commitf038e9cb00b9324b24a100d7cd3576410a7ae7f3 (patch)
treede867cbb42463d61fdaa020c247955388de8daad /src
parente718a582af615989bbb586dac9f99690f8db420f (diff)
downloadtor-f038e9cb00b9324b24a100d7cd3576410a7ae7f3.tar.gz
tor-f038e9cb00b9324b24a100d7cd3576410a7ae7f3.zip
Fix bug when disabling heartbeats.
Callbacks can't return 0.
Diffstat (limited to 'src')
-rw-r--r--src/or/main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index b9fee1d480..f585f0be62 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2004,18 +2004,24 @@ check_fw_helper_app_callback(time_t now, const or_options_t *options)
return PORT_FORWARDING_CHECK_INTERVAL;
}
+/** Callback to write heartbeat message in the logs. */
static int
heartbeat_callback(time_t now, const or_options_t *options)
{
static int first = 1;
- /* 12. write the heartbeat message */
+
+ /* Check if heartbeat is disabled */
+ if (!options->HeartbeatPeriod) {
+ return PERIODIC_EVENT_NO_UPDATE;
+ }
+
+ /* Write the heartbeat message */
if (first) {
first = 0; /* Skip the first one. */
} else {
log_heartbeat(now);
}
- /* XXXX This isn't such a good way to handle possible changes in the
- * callback event */
+
return options->HeartbeatPeriod;
}