aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2018-02-05 10:39:10 -0500
committerDavid Goulet <dgoulet@torproject.org>2018-02-05 13:38:55 -0500
commitf08fa974600625e4ea0b21d0143d28fe280008d5 (patch)
treebb1055857ca847d49f99baafe4fb7167f875d0d6 /src/or
parent78d6cb58707ff46464c591e45d81e83388427e2c (diff)
downloadtor-f08fa974600625e4ea0b21d0143d28fe280008d5.tar.gz
tor-f08fa974600625e4ea0b21d0143d28fe280008d5.zip
geoip: Make geoip_client_cache_total_allocation() return the counter
The HT_FOREACH() is insanely heavy on the CPU and this is part of the fast path so make it return the nice memory size counter we added in 4d812e29b9b1ec88. Fixes #25148 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or')
-rw-r--r--src/or/geoip.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 20dad5f159..a39366ed13 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -769,13 +769,7 @@ geoip_client_cache_handle_oom(time_t now, size_t min_remove_bytes)
size_t
geoip_client_cache_total_allocation(void)
{
- size_t bytes = 0;
- clientmap_entry_t **ent;
-
- HT_FOREACH(ent, clientmap, &client_history) {
- bytes += clientmap_entry_size(*ent);
- }
- return bytes;
+ return geoip_client_history_cache_size;
}
/** How many responses are we giving to clients requesting v3 network