[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Merge remote-tracking branch 'dgoulet/ticket24902_029_05'
commit eafa252b26ecf83a8a48e7e19a3315e1d2983186
Merge: 9e48338a1 475218c10
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri Feb 2 15:00:35 2018 -0500
Merge remote-tracking branch 'dgoulet/ticket24902_029_05'
changes/ticket25122 | 4 ++
src/or/geoip.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++--
src/or/geoip.h | 2 +
src/or/relay.c | 16 ++++--
src/test/test.c | 18 +++++++
5 files changed, 180 insertions(+), 8 deletions(-)
diff --cc src/or/geoip.c
index 5b954979b,20dad5f15..15871f0d2
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@@ -510,12 -541,18 +542,21 @@@ HT_PROTOTYPE(clientmap, clientmap_entry
HT_GENERATE2(clientmap, clientmap_entry_t, node, clientmap_entry_hash,
clientmap_entries_eq, 0.6, tor_reallocarray_, tor_free_)
+#define clientmap_entry_free(ent) \
+ FREE_AND_NULL(clientmap_entry_t, clientmap_entry_free_, ent)
+
+ /** Return the size of a client map entry. */
+ static inline size_t
+ clientmap_entry_size(const clientmap_entry_t *ent)
+ {
+ tor_assert(ent);
+ return (sizeof(clientmap_entry_t) +
+ (ent->transport_name ? strlen(ent->transport_name) : 0));
+ }
+
/** Free all storage held by <b>ent</b>. */
static void
-clientmap_entry_free(clientmap_entry_t *ent)
+clientmap_entry_free_(clientmap_entry_t *ent)
{
if (!ent)
return;
diff --cc src/or/relay.c
index b1b99526d,22ce76752..506b7eccb
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@@ -2613,11 -2469,15 +2613,15 @@@ static time_t last_time_under_memory_pr
STATIC int
cell_queues_check_size(void)
{
+ time_t now = time(NULL);
size_t alloc = cell_queues_get_total_allocation();
alloc += buf_get_total_allocation();
- alloc += tor_zlib_get_total_allocation();
+ alloc += tor_compress_get_total_allocation();
const size_t rend_cache_total = rend_cache_get_total_allocation();
alloc += rend_cache_total;
+ const size_t geoip_client_cache_total =
+ geoip_client_cache_total_allocation();
+ alloc += geoip_client_cache_total;
if (alloc >= get_options()->MaxMemInQueues_low_threshold) {
last_time_under_memory_pressure = approx_time();
if (alloc >= get_options()->MaxMemInQueues) {
@@@ -2627,7 -2487,15 +2631,13 @@@
if (rend_cache_total > get_options()->MaxMemInQueues / 5) {
const size_t bytes_to_remove =
rend_cache_total - (size_t)(get_options()->MaxMemInQueues / 10);
- alloc -= hs_cache_handle_oom(time(NULL), bytes_to_remove);
- rend_cache_clean_v2_descs_as_dir(now, bytes_to_remove);
- alloc -= rend_cache_total;
- alloc += rend_cache_get_total_allocation();
++ alloc -= hs_cache_handle_oom(now, bytes_to_remove);
+ }
+ if (geoip_client_cache_total > get_options()->MaxMemInQueues / 5) {
+ const size_t bytes_to_remove =
+ geoip_client_cache_total -
+ (size_t)(get_options()->MaxMemInQueues / 10);
+ alloc -= geoip_client_cache_handle_oom(now, bytes_to_remove);
}
circuits_handle_oom(alloc);
return 1;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits