diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-02-03 13:02:22 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-02-03 13:02:22 -0500 |
commit | 7f52dc4d03cc8b738b0c2a3896128ab38b030c52 (patch) | |
tree | eb5b062d2d194224c0422f207387914188c95059 /src/or/geoip.c | |
parent | 05f8fd2878e1b85822c126c0206f8b8929556868 (diff) | |
download | tor-7f52dc4d03cc8b738b0c2a3896128ab38b030c52.tar.gz tor-7f52dc4d03cc8b738b0c2a3896128ab38b030c52.zip |
Choose a more deliberate cutoff for clients in heartbeat
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r-- | src/or/geoip.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c index 810070c474..25e8135c61 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -1298,10 +1298,11 @@ format_bridge_stats_controller(time_t now) char * format_client_stats_heartbeat(time_t now) { + const int n_hours = 6; char *out = NULL; int n_clients = 0; clientmap_entry_t **ent; - double elapsed_time = 0; + unsigned cutoff = (unsigned)( (now-n_hours*3600)/60 ); if (!start_of_bridge_stats_interval) return NULL; /* Not initialized. */ @@ -1311,14 +1312,14 @@ format_client_stats_heartbeat(time_t now) /* only count directly connecting clients */ if ((*ent)->action != GEOIP_CLIENT_CONNECT) continue; + if ((*ent)->last_seen_in_minutes < cutoff) + continue; n_clients++; } - elapsed_time = difftime(now, start_of_bridge_stats_interval); - tor_asprintf(&out, "Heartbeat: " - "Since the last %ld hours, I have seen %d unique clients.", - tor_lround(elapsed_time / 3600), + "In the last %d hours, I have seen %d unique clients.", + n_hours, n_clients); return out; |