[tor-commits] [tor/master] Fix fencepost error with HearbeatPeriod option

arma at torproject.org arma at torproject.org
Wed Feb 8 09:44:53 UTC 2012


commit 332e96d1098b00ab21e635a19e9b427d3c735e33
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Sun Jan 22 13:39:56 2012 +0100

    Fix fencepost error with HearbeatPeriod option
    
    We'd only log every HeartbeatPeriod + 1 seconds. Discovered by Scott
    Bennett, reported as bug 4942.
---
 changes/bug4942 |    5 +++++
 src/or/main.c   |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/changes/bug4942 b/changes/bug4942
new file mode 100644
index 0000000..012d105
--- /dev/null
+++ b/changes/bug4942
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Actually log the heartbeat message every HeartbeatPeriod seconds, not
+      every HeartbeatPeriod + 1 seconds. Fixes bug 4942; bugfix on
+      0.2.3.1-alpha.. Bug reported by Scott Bennett.
+
diff --git a/src/or/main.c b/src/or/main.c
index 7ef14aa..9022f2e 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1533,7 +1533,7 @@ run_scheduled_events(time_t now)
 
   /** 12. write the heartbeat message */
   if (options->HeartbeatPeriod &&
-      time_to_next_heartbeat < now) {
+      time_to_next_heartbeat <= now) {
     log_heartbeat(now);
     time_to_next_heartbeat = now+options->HeartbeatPeriod;
   }



More information about the tor-commits mailing list