Browse Source

Merge remote-tracking branch 'origin/maint-0.2.2'

Nick Mathewson 14 years ago
parent
commit
6a726d34e1
2 changed files with 8 additions and 2 deletions
  1. 5 0
      changes/bug2704
  2. 3 2
      src/or/rephist.c

+ 5 - 0
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.
+

+ 3 - 2
src/or/rephist.c

@@ -1575,6 +1575,7 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
 {
   char *cp;
   int i,j;
+  uint64_t maxval;
 
   if (*s_values) {
     SMARTLIST_FOREACH(*s_values, char *, val, tor_free(val));
@@ -1608,7 +1609,6 @@ rep_hist_update_bwhist_state_section(or_state_t *state,
   /* Set i to first position in circular array */
   i = (b->num_maxes_set <= b->next_max_idx) ? 0 : b->next_max_idx;
   for (j=0; j < b->num_maxes_set; ++j,++i) {
-    uint64_t maxval;
     if (i >= NUM_TOTALS)
       i = 0;
     tor_asprintf(&cp, U64_FORMAT, U64_PRINTF_ARG(b->totals[i] & ~0x3ff));
@@ -1619,7 +1619,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);
 }