aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2016-06-21 13:03:38 +0000
committerIsis Lovecruft <isis@torproject.org>2017-07-12 03:08:02 +0000
commitf516c9ca99e4c3ef1bfeb3693e622befdd7954d2 (patch)
treeceb0dbb74b3e7d4000446027bf9d23f3704642e2 /src/or
parent7b2364035a6f80fd3158e1b6d7b0034989aefb38 (diff)
downloadtor-f516c9ca99e4c3ef1bfeb3693e622befdd7954d2.tar.gz
tor-f516c9ca99e4c3ef1bfeb3693e622befdd7954d2.zip
Use the return value for choosing intervals
Diffstat (limited to 'src/or')
-rw-r--r--src/or/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 5fa3869ff8..41167408cb 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2071,14 +2071,19 @@ heartbeat_callback(time_t now, const or_options_t *options)
return PERIODIC_EVENT_NO_UPDATE;
}
- /* Write the heartbeat message */
+ /* Skip the first one. */
if (first) {
- first = 0; /* Skip the first one. */
- } else {
- log_heartbeat(now);
+ first = 0;
+ return options->HeartbeatPeriod;
}
- return options->HeartbeatPeriod;
+ /* Write the heartbeat message */
+ int r = log_heartbeat(now);
+ if (r == 0) {
+ return options->HeartbeatPeriod;
+ }
+
+ return PERIODIC_EVENT_NO_UPDATE;
}
#define CDM_CLEAN_CALLBACK_INTERVAL 600