aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-05-17 10:03:41 -0400
committerNick Mathewson <nickm@torproject.org>2019-05-17 10:03:41 -0400
commit37aae23945c45c459091b38699130a14466d33ef (patch)
treea2ddd27615d9bf488f51fbd2f3a6df4be57ac756 /src/feature/relay/dns.c
parente5deb2bbc73d8830ae6c479a4532e72112f5484a (diff)
downloadtor-37aae23945c45c459091b38699130a14466d33ef.tar.gz
tor-37aae23945c45c459091b38699130a14466d33ef.zip
OOM-purge the DNS cache one part at a time
Previously we purged it in 1-hour increments -- but one-hour is the maximum TTL for the cache! Now we do it in 25%-TTL increments. Fixes bug 29617; bugfix on 0.3.5.1-alpha.
Diffstat (limited to 'src/feature/relay/dns.c')
-rw-r--r--src/feature/relay/dns.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index d3660c47ef..cc9f4cf490 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -2130,7 +2130,8 @@ dns_cache_handle_oom(time_t now, size_t min_remove_bytes)
current_size -= bytes_removed;
total_bytes_removed += bytes_removed;
- time_inc += 3600; /* Increase time_inc by 1 hour. */
+ /* Increase time_inc by a reasonable fraction. */
+ time_inc += (MAX_DNS_TTL_AT_EXIT / 4);
} while (total_bytes_removed < min_remove_bytes);
return total_bytes_removed;