[tor-commits] [tor/master] Fix more of bug 2704

nickm at torproject.org nickm at torproject.org
Tue Apr 26 15:14:08 UTC 2011


commit 6fde2b46d2cc2345ec955b1ed9674a777e5e8716
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Tue Apr 26 15:33:08 2011 +0200

    Fix more of bug 2704
    
    The last entry of the *Maxima values in the state file was inflated by a
    factor of NUM_SECS_ROLLING_MEASURE (currently 10). This could lead to
    a wrong maximum value propagating through the state file history.
---
 changes/bug2704  |    5 +++++
 src/or/rephist.c |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/changes/bug2704 b/changes/bug2704
new file mode 100644
index 0000000..821b38b
--- /dev/null
+++ b/changes/bug2704
@@ -0,0 +1,5 @@
+  o Major bugfixes:
+    - When writing our maximum bw for the current interval to the state
+      file, don't wrongly inflate that value by a factor of 10 anymore.
+      Fixes more of bug 2704.
+
diff --git a/src/or/rephist.c b/src/or/rephist.c
index fb091d5..9146fce 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1614,7 +1614,8 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
   }
   tor_asprintf(&cp, U64_FORMAT, U64_PRINTF_ARG(b->total_in_period & ~0x3ff));
   smartlist_add(*s_values, cp);
-  tor_asprintf(&cp, U64_FORMAT, U64_PRINTF_ARG(b->max_total & ~0x3ff));
+  maxval = b->max_total / NUM_SECS_ROLLING_MEASURE;
+  tor_asprintf(&cp, U64_FORMAT, U64_PRINTF_ARG(maxval & ~0x3ff));
   smartlist_add(*s_maxima, cp);
 }
 





More information about the tor-commits mailing list