aboutsummaryrefslogtreecommitdiff
path: root/src/or/status.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-20 01:24:36 -0500
committerNick Mathewson <nickm@torproject.org>2015-02-23 13:03:56 -0500
commit10ae9b9bf5882287ada74bc3e90f65ca64c27fab (patch)
treeb137f31efb3fb56a5f13dbc54cf9dd3cee4ebb38 /src/or/status.c
parent251f6cfcd829d3f7b8ac7bce8477a6e14ad47a1e (diff)
downloadtor-10ae9b9bf5882287ada74bc3e90f65ca64c27fab.tar.gz
tor-10ae9b9bf5882287ada74bc3e90f65ca64c27fab.zip
Usually downgrade middle heartbeat messages when stuff is in-range
Diffstat (limited to 'src/or/status.c')
-rw-r--r--src/or/status.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/or/status.c b/src/or/status.c
index 98db688e5b..27d21e2914 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -110,22 +110,31 @@ log_heartbeat(time_t now)
log_fn(LOG_NOTICE, LD_HEARTBEAT, "Heartbeat: Tor's uptime is %s, with %d "
"circuits open. I've sent %s and received %s.%s",
- uptime, count_circuits(),bw_sent,bw_rcvd,
+ uptime, count_circuits(), bw_sent, bw_rcvd,
hibernating?" We are currently hibernating.":"");
if (server_mode(options) && accounting_is_enabled(options) && !hibernating) {
log_accounting(now, options);
}
- 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)) );
-
- if (r > 1.0) {
- double overhead = ( r - 1.0 ) * 100.0;
- log_notice(LD_HEARTBEAT, "TLS write overhead: %.f%%", overhead);
+ double fullness_pct = 100;
+ if (stats_n_data_cells_packaged && !hibernating) {
+ fullness_pct =
+ 100*(U64_TO_DBL(stats_n_data_bytes_packaged) /
+ U64_TO_DBL(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE));
}
+ const double overhead_pct = ( r - 1.0 ) * 100.0;
+
+#define FULLNESS_PCT_THRESHOLD 80
+#define TLS_OVERHEAD_THRESHOLD 15
+
+ const int severity = (fullness_pct < FULLNESS_PCT_THRESHOLD ||
+ overhead_pct > TLS_OVERHEAD_THRESHOLD)
+ ? LOG_NOTICE : LOG_INFO;
+
+ log_fn(severity, LD_HEARTBEAT,
+ "Average packaged cell fullness: %2.3f%%"
+ "TLS write overhead: %.f%%", fullness_pct, overhead_pct);
if (public_server_mode(options))
rep_hist_log_circuit_handshake_stats(now);