]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Correctly check elapsed time in last hibernation period
authorSebastian Hahn <sebastian@torproject.org>
Thu, 28 Apr 2011 23:18:32 +0000 (01:18 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Thu, 28 Apr 2011 23:18:32 +0000 (01:18 +0200)
Fix bug 3020.

changes/bug3020 [new file with mode: 0644]
src/or/hibernate.c

diff --git a/changes/bug3020 b/changes/bug3020
new file mode 100644 (file)
index 0000000..b987161
--- /dev/null
@@ -0,0 +1,7 @@
+  o Minor bugfixes:
+    - When checking whether a hibernation period has fully elapsed, use
+      the amount of seconds we expect for that period instead of using
+      the new period that just started. This would cause an issue because
+      February is a really short month. Bugfix on 0.2.2.17-alpha;
+      fixes bug 3020.
+
index 1878d5d52d7e4cb07d9e033d0de60e2dcd2ff4fe..aebce4cc883e96f8433d463ed5a256bcbce70bf0 100644 (file)
@@ -378,7 +378,8 @@ configure_accounting(time_t now)
     /* We are in the interval we thought we were in. Do nothing.*/
     interval_end_time = start_of_accounting_period_after(interval_start_time);
   } else {
-    long duration = length_of_accounting_period_containing(now);
+    long duration =
+      length_of_accounting_period_containing(interval_start_time);
     double delta = ((double)(s_now - interval_start_time)) / duration;
     if (-0.50 <= delta && delta <= 0.50) {
       /* The start of the period is now a little later or earlier than we