dnscache: slight refactoring

Slight refactoring around dnscache, e.g. hostcache

- eliminate `data->state.hostcache`. Always look up
  relevant dnscache at share/multi.
- unify naming to "dnscache", replacing "hostcache"
- use `struct Curl_dnscache`, even though it just
  contains a `Curl_hash` for now.
- add `Curl_dnscache_destroy()` for cleanup in
  share/multi.

Closes #16941
This commit is contained in:
Stefan Eissing 2025-04-03 13:11:32 +02:00 committed by Daniel Stenberg
parent 6140a574de
commit 01e76702ac
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
14 changed files with 217 additions and 255 deletions

View file

@ -46,7 +46,7 @@ curl_share_init(void)
if(share) {
share->magic = CURL_GOOD_SHARE;
share->specifier |= (1 << CURL_LOCK_DATA_SHARE);
Curl_init_dnscache(&share->hostcache, 23);
Curl_dnscache_init(&share->dnscache, 23);
share->admin = curl_easy_init();
if(!share->admin) {
free(share);
@ -247,7 +247,8 @@ curl_share_cleanup(CURLSH *sh)
if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) {
Curl_cpool_destroy(&share->cpool);
}
Curl_hash_destroy(&share->hostcache);
Curl_dnscache_destroy(&share->dnscache);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
Curl_cookie_cleanup(share->cookies);