aboutsummaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 67dea965f..73194ae9c 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -976,7 +976,8 @@ geoip_dirreq_stats_term(void)
}
/** Return a newly allocated string containing the dirreq statistics
- * until <b>now</b>, or NULL if we're not collecting dirreq stats. */
+ * until <b>now</b>, or NULL if we're not collecting dirreq stats. Caller
+ * must ensure start_of_dirreq_stats_interval is in the past. */
char *
geoip_format_dirreq_stats(time_t now)
{
@@ -992,6 +993,8 @@ geoip_format_dirreq_stats(time_t now)
if (!start_of_dirreq_stats_interval)
return NULL; /* Not initialized. */
+ tor_assert(now >= start_of_dirreq_stats_interval);
+
format_iso_time(t, now);
v2_ips_string = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS_V2);
v3_ips_string = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS);
@@ -1351,7 +1354,8 @@ geoip_entry_stats_term(void)
}
/** Return a newly allocated string containing the entry statistics
- * until <b>now</b>, or NULL if we're not collecting entry stats. */
+ * until <b>now</b>, or NULL if we're not collecting entry stats. Caller
+ * must ensure start_of_entry_stats_interval lies in the past. */
char *
geoip_format_entry_stats(time_t now)
{
@@ -1362,6 +1366,8 @@ geoip_format_entry_stats(time_t now)
if (!start_of_entry_stats_interval)
return NULL; /* Not initialized. */
+ tor_assert(now >= start_of_entry_stats_interval);
+
data = geoip_get_client_history(GEOIP_CLIENT_CONNECT);
format_iso_time(t, now);
tor_asprintf(&result, "entry-stats-end %s (%u s)\nentry-ips %s\n",