diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-06-28 14:23:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-11 16:13:17 -0400 |
commit | b25ca8af06532d3847ce11040f970a1c001c1ad8 (patch) | |
tree | 733d5d3b37a88ebcc1dd91591b8a3ab4099f6d96 /src/or/connection_or.c | |
parent | 734d9486f62b0fb19c71cac7a484ae65091bd41d (diff) | |
download | tor-b25ca8af06532d3847ce11040f970a1c001c1ad8.tar.gz tor-b25ca8af06532d3847ce11040f970a1c001c1ad8.zip |
Limit the number of different handshake reasons to report
If connections failed in more than 10 different states, let's just
report the top ten states.
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r-- | src/or/connection_or.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 85df78bd6c..b5cd68a964 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -222,6 +222,9 @@ broken_state_count_compare(const void **a_ptr, const void **b_ptr) } /** DOCDOC */ +#define MAX_REASONS_TO_REPORT 10 + +/** DOCDOC */ void connection_or_report_broken_states(int severity, int domain) { @@ -242,9 +245,12 @@ connection_or_report_broken_states(int severity, int domain) smartlist_sort(items, broken_state_count_compare); - log(severity, domain, "%d connections have failed:", total); + log(severity, domain, "%d connections have failed%s", total, + smartlist_len(items) > MAX_REASONS_TO_REPORT ? ". Top reasons:" : ":"); SMARTLIST_FOREACH_BEGIN(items, const broken_state_count_t *, c) { + if (c_sl_idx > MAX_REASONS_TO_REPORT) + break; log(severity, domain, " %d connections died in state %s", (int)c->count, c->state); } SMARTLIST_FOREACH_END(c); |