summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-12-01 03:24:03 +0200
committerNick Mathewson <nickm@torproject.org>2011-02-22 12:40:36 -0500
commit098b6ba72d636cf00cfa091e745c25a649fba493 (patch)
tree76d4890c31b79fc686d1d79f6440b11d88a9adbc /src/or/main.c
parent0ba69714b4c51bfddcce16b7e1b309fad4e3e3bc (diff)
downloadtor-098b6ba72d636cf00cfa091e745c25a649fba493.tar.gz
tor-098b6ba72d636cf00cfa091e745c25a649fba493.zip
Initial heartbeat subsystem commit.
Sets: * Documentation * Logging domain * Configuration option * Scheduled event * Makefile It also creates status.c and the log_heartbeat() function. All code was written by Sebastian Hahn. Commit message was written by me (George Kadianakis).
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index c6fd2c0593..6e3cb2b386 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1050,6 +1050,7 @@ run_scheduled_events(time_t now)
static time_t time_to_check_port_forwarding = 0;
static int should_init_bridge_stats = 1;
static time_t time_to_retry_dns_init = 0;
+ static time_t time_last_written_heartbeat = 0;
or_options_t *options = get_options();
int is_server = server_mode(options);
int i;
@@ -1440,6 +1441,12 @@ run_scheduled_events(time_t now)
now);
time_to_check_port_forwarding = now+PORT_FORWARDING_CHECK_INTERVAL;
}
+
+ /** 11. write the heartbeat message */
+ if (options->HeartbeatPeriod &&
+ time_last_written_heartbeat + options->HeartbeatPeriod < now)
+ log_heartbeat(now);
+ time_last_written_heartbeat = now;
}
/** Timer: used to invoke second_elapsed_callback() once per second. */