diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-05-11 10:08:52 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2021-05-11 10:08:52 -0400 |
commit | 6e140c530cf8c080ec6c1bb8aeb82e5a0c6dd1ff (patch) | |
tree | 24629df41a8d54d2dbd6d1524a3ddbda60dd2948 | |
parent | d82970c8c316e70abf49b2e37f6e7ba3db32585b (diff) | |
download | tor-6e140c530cf8c080ec6c1bb8aeb82e5a0c6dd1ff.tar.gz tor-6e140c530cf8c080ec6c1bb8aeb82e5a0c6dd1ff.zip |
Make client heartbeat stats tied to the heartbeat period.
Patch from cypherpunks. Closes #40330.
-rw-r--r-- | src/feature/stats/geoip_stats.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/feature/stats/geoip_stats.c b/src/feature/stats/geoip_stats.c index b4b107c3f7..a0fe8597c1 100644 --- a/src/feature/stats/geoip_stats.c +++ b/src/feature/stats/geoip_stats.c @@ -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; |