aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/relay.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-08-10 12:35:06 -0400
committerNick Mathewson <nickm@torproject.org>2018-08-10 12:35:06 -0400
commitb7ed61167fb3ed9d3b623d008bf3360a3ffa95c4 (patch)
treef5d05295ceddc4f01e4accb33ec94a37bce35b11 /src/core/or/relay.c
parent5980cb8a19e87b6d8b471de55eb659004fa97b59 (diff)
parenta207511bb0cc86b20a5ed682898a74660efdd5b2 (diff)
downloadtor-b7ed61167fb3ed9d3b623d008bf3360a3ffa95c4.tar.gz
tor-b7ed61167fb3ed9d3b623d008bf3360a3ffa95c4.zip
Merge remote-tracking branch 'tor-github/pr/239'
Diffstat (limited to 'src/core/or/relay.c')
-rw-r--r--src/core/or/relay.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/or/relay.c b/src/core/or/relay.c
index 51084e2a17..6e1adfaff3 100644
--- a/src/core/or/relay.c
+++ b/src/core/or/relay.c
@@ -64,6 +64,7 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dircache/directory.h"
+#include "feature/relay/dns.h"
#include "feature/stats/geoip.h"
#include "feature/hs/hs_cache.h"
#include "core/mainloop/main.h"
@@ -2538,6 +2539,8 @@ cell_queues_check_size(void)
const size_t geoip_client_cache_total =
geoip_client_cache_total_allocation();
alloc += geoip_client_cache_total;
+ const size_t dns_cache_total = dns_cache_total_allocation();
+ alloc += dns_cache_total;
if (alloc >= get_options()->MaxMemInQueues_low_threshold) {
last_time_under_memory_pressure = approx_time();
if (alloc >= get_options()->MaxMemInQueues) {
@@ -2555,6 +2558,11 @@ cell_queues_check_size(void)
(size_t)(get_options()->MaxMemInQueues / 10);
alloc -= geoip_client_cache_handle_oom(now, bytes_to_remove);
}
+ if (dns_cache_total > get_options()->MaxMemInQueues / 5) {
+ const size_t bytes_to_remove =
+ dns_cache_total - (size_t)(get_options()->MaxMemInQueues / 10);
+ alloc -= dns_cache_handle_oom(now, bytes_to_remove);
+ }
circuits_handle_oom(alloc);
return 1;
}