diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-07-13 16:58:45 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-07-13 16:58:45 -0400 |
commit | 62d241ad22b173ee908ad9cc2c55f5b10d22c2d9 (patch) | |
tree | 4db71ab176e2f30f399b015d4d7edb2bde1ee96e /src/or/main.c | |
parent | 66a564fad8a99a21bd6cda6a70982858376b78e9 (diff) | |
parent | 175451d032026f1e1cbf45dfa55a408d5d4abeed (diff) | |
download | tor-62d241ad22b173ee908ad9cc2c55f5b10d22c2d9.tar.gz tor-62d241ad22b173ee908ad9cc2c55f5b10d22c2d9.zip |
Merge remote-tracking branch 'isis/bug19476'
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c index 7e2652cb86..0a0943d344 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2060,6 +2060,9 @@ check_fw_helper_app_callback(time_t now, const or_options_t *options) /** * Periodic callback: write the heartbeat message in the logs. + * + * If writing the heartbeat message to the logs fails for some reason, retry + * again after <b>MIN_HEARTBEAT_PERIOD</b> seconds. */ static int heartbeat_callback(time_t now, const or_options_t *options) @@ -2071,14 +2074,20 @@ 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 */ + if (log_heartbeat(now) == 0) { + return options->HeartbeatPeriod; + } else { + /* If we couldn't write the heartbeat log message, try again in the minimum + * interval of time. */ + return MIN_HEARTBEAT_PERIOD; + } } #define CDM_CLEAN_CALLBACK_INTERVAL 600 |