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:
Daniel Stenberg 2025-08-04 14:15:03 +02:00
parent be71475b13
commit 854b0e230c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 51 additions and 45 deletions

View file

@ -67,7 +67,7 @@ struct Curl_dns_entry {
struct Curl_https_rrinfo *hinfo;
#endif
/* timestamp == 0 -- permanent CURLOPT_RESOLVE entry (does not time out) */
time_t timestamp;
struct curltime timestamp;
/* reference counter, entry is freed on reaching 0 */
size_t refcount;
/* hostname port number that resolved to addr. */