mirror of
https://github.com/curl/curl.git
synced 2026-08-25 07:33:36 +03:00
hostip: do DNS cache pruning in milliseconds
Instead of using integer seconds. Also: if the cache contains over 30,000 entries after first pruning, it makes anoter round and removes all entries that are older than half the age of the oldest entry until it goes below 30,000. Closes #18160
This commit is contained in:
parent
be71475b13
commit
854b0e230c
6 changed files with 51 additions and 45 deletions
|
|
@ -868,10 +868,12 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
|
|||
case CURLOPT_DNS_CACHE_TIMEOUT:
|
||||
if(arg < -1)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
else if(arg > INT_MAX)
|
||||
arg = INT_MAX;
|
||||
else if(arg > INT_MAX/1000)
|
||||
arg = INT_MAX/1000;
|
||||
|
||||
s->dns_cache_timeout = (int)arg;
|
||||
if(arg > 0)
|
||||
arg *= 1000;
|
||||
s->dns_cache_timeout_ms = (int)arg;
|
||||
break;
|
||||
case CURLOPT_CA_CACHE_TIMEOUT:
|
||||
if(Curl_ssl_supports(data, SSLSUPP_CA_CACHE)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue