[tor-commits] [tor/maint-0.2.2] Don't sometimes undercount bw average

nickm at torproject.org nickm at torproject.org
Tue Apr 19 19:40:35 UTC 2011


commit 13c3884ff60aa0e58464f379f988683f1c30438a
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Tue Apr 19 17:12:27 2011 +0200

    Don't sometimes undercount bw average
    
    This fixes the first part of bug 2704. It should occur only rarely when
    no bw maxima are known. Bugfix on 0.2.2.23-alpha. Fixes bug 2704.
---
 changes/bug2704_part1 |    5 +++++
 src/or/rephist.c      |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/changes/bug2704_part1 b/changes/bug2704_part1
new file mode 100644
index 0000000..eaf2281
--- /dev/null
+++ b/changes/bug2704_part1
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Fix an issue causing calculation of Tor's average bandwidth as saved
+      in the state file to be 10 times smaller than it should be. Fixes the
+      first part of bug 2704, bugfix on tor-0.2.2.23-alpha.
+
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 9b7eefe..6034bbc 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1673,7 +1673,7 @@ rep_hist_load_bwhist_state_section(bw_array_t *b,
           mv *= NUM_SECS_ROLLING_MEASURE;
         } else {
           /* No maxima known; guess average rate to be conservative. */
-          mv = v / s_interval;
+          mv = (v / s_interval) * NUM_SECS_ROLLING_MEASURE;
         }
         if (!ok) {
           retval = -1;





More information about the tor-commits mailing list