summaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-12-16 21:59:25 -0500
committerNick Mathewson <nickm@torproject.org>2009-12-16 21:59:25 -0500
commit62c2a5a8838ac8eb97ab967e10e7a1e99d761d94 (patch)
treee408dcac0370063dba78ecb04cbff084a13be133 /src/or/rephist.c
parent350181529e39c5b9dcec7f1ae7edf15946fee501 (diff)
parentb9b430e136998e0e796d1879250cc7c8c84a01da (diff)
downloadtor-62c2a5a8838ac8eb97ab967e10e7a1e99d761d94.tar.gz
tor-62c2a5a8838ac8eb97ab967e10e7a1e99d761d94.zip
Merge commit 'karsten/fix-cell-stats'
Conflicts: ChangeLog
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 78ceb5f0d7..36318c7558 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -2705,9 +2705,16 @@ rep_hist_buffer_stats_write(time_t now)
memset(circs_in_share, 0, SHARES * sizeof(int));
memset(queued_cells, 0, SHARES * sizeof(double));
memset(time_in_queue, 0, SHARES * sizeof(double));
+ if (!circuits_for_buffer_stats)
+ circuits_for_buffer_stats = smartlist_create();
smartlist_sort(circuits_for_buffer_stats,
_buffer_stats_compare_entries);
number_of_circuits = smartlist_len(circuits_for_buffer_stats);
+ if (number_of_circuits < 1) {
+ log_info(LD_HIST, "Attempt to write cell statistics to disk failed. "
+ "We haven't seen a single circuit to report about.");
+ goto done;
+ }
i = 0;
SMARTLIST_FOREACH_BEGIN(circuits_for_buffer_stats,
circ_buffer_stats_t *, stat)