[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/main] Fix the fencepost issue when we check stability_last_downrated



commit 96b59fc4d3486c06d3661adb34a5d32d5ff8e842
Author: Neel Chauhan <neel@xxxxxxxxx>
Date:   Thu May 20 11:06:50 2021 -0700

    Fix the fencepost issue when we check stability_last_downrated
---
 changes/bug40394            | 4 ++++
 src/feature/stats/rephist.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/changes/bug40394 b/changes/bug40394
new file mode 100644
index 0000000000..f55167f2dd
--- /dev/null
+++ b/changes/bug40394
@@ -0,0 +1,4 @@
+  o Minor bugfixes (statistics):
+    - Fix the fencepost issue when we check stability_last_downrated where
+      we call rep_hist_downrate_old_runs() twice. Fixes bug 40394; bugfix
+      on 0.2.0.5-alpha. Patch by Neel Chauhan.
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index 50f6a11ae1..59d5313cc8 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -731,7 +731,7 @@ rep_hist_downrate_old_runs(time_t now)
     return stability_last_downrated + STABILITY_INTERVAL;
 
   /* Okay, we should downrate the data.  By how much? */
-  while (stability_last_downrated + STABILITY_INTERVAL < now) {
+  while (stability_last_downrated + STABILITY_INTERVAL <= now) {
     stability_last_downrated += STABILITY_INTERVAL;
     alpha *= STABILITY_ALPHA;
   }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits