Browse Source

Tweak/cleanup 5526 fix.

Nick Mathewson 10 years ago
parent
commit
71ec90fdc8
4 changed files with 8 additions and 5 deletions
  1. 1 1
      changes/ticket5526
  2. 1 0
      src/or/hibernate.c
  3. 6 3
      src/or/status.c
  4. 0 1
      src/or/status.h

+ 1 - 1
changes/ticket5526

@@ -1,4 +1,4 @@
   o Minor features:
     - Log current accounting state (bytes sent and received + remaining
       time for the current accounting period) in the server's
-      heartbeat message. 
+      heartbeat message. Implements ticket 5526; patch from Peter Retzlaff.

+ 1 - 0
src/or/hibernate.c

@@ -255,6 +255,7 @@ accounting_get_interval_length(void)
   return (int)(interval_end_time - interval_start_time);
 }
 
+/** Return the time at which the current accounting interval will end. */
 time_t
 accounting_get_end_time(void)
 {

+ 6 - 3
src/or/status.c

@@ -17,6 +17,8 @@
 #include "hibernate.h"
 #include "statefile.h"
 
+static void log_accounting(const time_t now, const or_options_t *options);
+
 /** Return the total number of circuits. */
 static int
 count_circuits(void)
@@ -133,7 +135,7 @@ log_heartbeat(time_t now)
   return 0;
 }
 
-void
+static void
 log_accounting(const time_t now, const or_options_t *options)
 {
   or_state_t *state = get_or_state();
@@ -146,9 +148,9 @@ log_accounting(const time_t now, const or_options_t *options)
   format_local_iso_time(end_buf, interval_end);
   remaining = secs_to_uptime(interval_end - now);
 
-  log_notice(LD_HEARTBEAT, "Heartbeat: "
+  log_notice(LD_HEARTBEAT, "Heartbeat: Accounting enabled. "
       "Sent: %s / %s, Received: %s / %s. The "
-      "current accounting period ends on %s. That's %s left to go.",
+      "current accounting interval ends on %s, in %s.",
       acc_sent, acc_max, acc_rcvd, acc_max, end_buf, remaining);
 
   tor_free(acc_rcvd);
@@ -156,3 +158,4 @@ log_accounting(const time_t now, const or_options_t *options)
   tor_free(acc_max);
   tor_free(remaining);
 }
+

+ 0 - 1
src/or/status.h

@@ -5,7 +5,6 @@
 #define TOR_STATUS_H
 
 int log_heartbeat(time_t now);
-void log_accounting(const time_t now, const or_options_t *options);
 
 #endif