[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Merge branch 'bug13806_squashed'
commit c2e200cef8b910434d8b5d251597081935392377
Merge: b0c3210 3033ba9
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Mon Jan 12 13:59:26 2015 -0500
Merge branch 'bug13806_squashed'
Conflicts:
src/or/relay.c
changes/bug13806 | 8 ++++
src/or/main.c | 2 +-
src/or/or.h | 2 +
src/or/relay.c | 18 ++++++--
src/or/rendcommon.c | 121 ++++++++++++++++++++++++++++++++++++++++++---------
src/or/rendcommon.h | 4 +-
6 files changed, 129 insertions(+), 26 deletions(-)
diff --cc src/or/relay.c
index 2d11096,50070b7..28211ff
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@@ -2447,13 -2441,22 +2447,25 @@@ cell_queues_check_size(void
size_t alloc = cell_queues_get_total_allocation();
alloc += buf_get_total_allocation();
alloc += tor_zlib_get_total_allocation();
+ const size_t rend_cache_total = rend_cache_get_total_allocation();
+ alloc += rend_cache_total;
+ if (alloc >= get_options()->MaxMemInQueues_low_threshold) {
+ last_time_under_memory_pressure = approx_time();
- if (alloc >= get_options()->MaxMemInQueues) {
- circuits_handle_oom(alloc);
- return 1;
+ if (alloc >= get_options()->MaxMemInQueues) {
+ /* If we're spending over 20% of the memory limit on hidden service
+ * descriptors, free them until we're down to 10%.
+ */
+ if (rend_cache_total > get_options()->MaxMemInQueues / 5) {
+ const size_t bytes_to_remove =
+ rend_cache_total - (get_options()->MaxMemInQueues / 10);
+ rend_cache_clean_v2_descs_as_dir(time(NULL), bytes_to_remove);
+ alloc -= rend_cache_total;
+ alloc += rend_cache_get_total_allocation();
}
+ circuits_handle_oom(alloc);
+ return 1;
+ }
+ }
return 0;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits