]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Bug 8235: Fix scaling adjustments.
authorMike Perry <mikeperry-git@fscked.org>
Tue, 23 Apr 2013 21:43:38 +0000 (14:43 -0700)
committerNick Mathewson <nickm@torproject.org>
Thu, 25 Apr 2013 02:03:02 +0000 (22:03 -0400)
We need to subtract both the current built circuits *and* the attempted
circuits from the attempt count during scaling, since *both* have already been
counted there.

src/or/circuitbuild.c

index 31242f6c14f94b98c2c43eb41e0ba55bbc0ca002..43d2ffe4db5fa39c64b5b64769739e2d601734f7 100644 (file)
@@ -2491,7 +2491,7 @@ pathbias_scale_close_rates(entry_guard_t *guard)
     /* Verify that the counts are sane before and after scaling */
     int counts_are_sane = (guard->circ_attempts >= guard->circ_successes);
 
-    guard->circ_attempts -= opened_attempts;
+    guard->circ_attempts -= (opened_attempts+opened_built);
     guard->circ_successes -= opened_built;
 
     guard->circ_attempts *= scale_ratio;
@@ -2501,7 +2501,7 @@ pathbias_scale_close_rates(entry_guard_t *guard)
     guard->collapsed_circuits *= scale_ratio;
     guard->unusable_circuits *= scale_ratio;
 
-    guard->circ_attempts += opened_attempts;
+    guard->circ_attempts += (opened_attempts+opened_built);
     guard->circ_successes += opened_built;
 
     entry_guards_changed();