diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-08-08 19:14:44 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-08-08 19:14:44 +0000 |
commit | 0652a0e90a9b04fd5cc80f376788763e3122713b (patch) | |
tree | 3c41bbd45be1aabe23ceb4177c0920c3a41787d0 | |
parent | f753ef4ac6c3bfcb0ac7e9f0c47ab0240069f9f5 (diff) | |
download | tor-0652a0e90a9b04fd5cc80f376788763e3122713b.tar tor-0652a0e90a9b04fd5cc80f376788763e3122713b.tar.gz |
Fix a fencepost error in the last bandwidth reporting fix
svn:r2202
-rw-r--r-- | src/or/rephist.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 5159aa51f..af780e48c 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -506,13 +506,16 @@ char *rep_hist_get_bandwidth_lines(void) for (r=0;r<2;++r) { b = r?read_array:write_array; format_iso_time(t, b->next_period-NUM_SECS_BW_SUM_INTERVAL); - sprintf(cp, "opt %s %s (%d s)", r?"read-history ":"write-history", t, + sprintf(cp, "opt %s %s (%d s) ", r?"read-history ":"write-history", t, NUM_SECS_BW_SUM_INTERVAL); cp += strlen(cp); - if (b->num_maxes_set < b->next_max_idx) + if (b->num_maxes_set <= b->next_max_idx) + /* We haven't been through the circular array yet; time starts at i=0.*/ i = 0; else + /* We've been arround the array at least once. The next i to be + overwritten is the oldest. */ i = b->next_max_idx; for (n=0; n<b->num_maxes_set; ++n,++i) { |