aboutsummaryrefslogtreecommitdiff
path: root/src/or/status.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-11 20:50:02 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-11 20:50:02 -0400
commit34f07ec8629a94b87fd19f93bb62d4f91286fbc6 (patch)
treedd6aa913610fd652dc32f97fe358e719f0ff481b /src/or/status.c
parent051b1e8ac4114fb23904cdf8dead72d585904e0a (diff)
downloadtor-34f07ec8629a94b87fd19f93bb62d4f91286fbc6.tar
tor-34f07ec8629a94b87fd19f93bb62d4f91286fbc6.tar.gz
When hibernating, don't heartbeat about problems.
Fixes part of 7302.
Diffstat (limited to 'src/or/status.c')
-rw-r--r--src/or/status.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/status.c b/src/or/status.c
index 126167dcb..6a43fc4d8 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -14,6 +14,7 @@
#include "router.h"
#include "circuitlist.h"
#include "main.h"
+#include "hibernate.h"
/** Return the total number of circuits. */
static int
@@ -85,11 +86,12 @@ log_heartbeat(time_t now)
char *bw_rcvd = NULL;
char *uptime = NULL;
const routerinfo_t *me;
+ const int hibernating = we_are_hibernating();
const or_options_t *options = get_options();
(void)now;
- if (public_server_mode(options)) {
+ if (public_server_mode(options) && !hibernating) {
/* Let's check if we are in the current cached consensus. */
if (!(me = router_get_my_routerinfo()))
return -1; /* Something stinks, we won't even attempt this. */
@@ -104,10 +106,11 @@ log_heartbeat(time_t now)
bw_sent = bytes_to_usage(get_bytes_written());
log_fn(LOG_NOTICE, LD_HEARTBEAT, "Heartbeat: Tor's uptime is %s, with %d "
- "circuits open. I've sent %s and received %s.",
- uptime, count_circuits(),bw_sent,bw_rcvd);
+ "circuits open. I've sent %s and received %s.%s",
+ uptime, count_circuits(),bw_sent,bw_rcvd,
+ hibernating?" We are currently hibernating.":"");
- if (stats_n_data_cells_packaged)
+ if (stats_n_data_cells_packaged && !hibernating)
log_notice(LD_HEARTBEAT, "Average packaged cell fullness: %2.3f%%",
100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );