]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make client heartbeat stats tied to the heartbeat period.
authorNick Mathewson <nickm@torproject.org>
Tue, 11 May 2021 14:08:52 +0000 (10:08 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 11 May 2021 14:08:52 +0000 (10:08 -0400)
Patch from cypherpunks. Closes #40330.

src/feature/stats/geoip_stats.c

index b4b107c3f72d41a8b00d05c8934a90142f9f7caf..a0fe8597c18aeba313b8d973956584e1c0c09c6d 100644 (file)
@@ -1206,11 +1206,11 @@ format_bridge_stats_controller(time_t now)
 char *
 format_client_stats_heartbeat(time_t now)
 {
-  const int n_hours = 6;
+  const int n_seconds = get_options()->HeartbeatPeriod;
   char *out = NULL;
   int n_clients = 0;
   clientmap_entry_t **ent;
-  unsigned cutoff = (unsigned)( (now-n_hours*3600)/60 );
+  unsigned cutoff = (unsigned)( (now-n_seconds)/60 );
 
   if (!start_of_bridge_stats_interval)
     return NULL; /* Not initialized. */
@@ -1226,8 +1226,7 @@ format_client_stats_heartbeat(time_t now)
   }
 
   tor_asprintf(&out, "Heartbeat: "
-               "In the last %d hours, I have seen %d unique clients.",
-               n_hours,
+               "Since last heartbeat message, I have seen %d unique clients.",
                n_clients);
 
   return out;