async-threaded resolver: use ref counter

Allocate the data shared between a transfer and an aync resolver
thread separately and use a reference counter to determine its
release.

Closes #16847
This commit is contained in:
Stefan Eissing 2025-03-27 13:55:49 +01:00 committed by Daniel Stenberg
parent 23dfb47595
commit 19226f9bb1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 140 additions and 102 deletions

View file

@ -344,10 +344,8 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
dns = Curl_fetch_addr(data, sx->hostname, conn->primary.remote_port);
if(dns) {
#ifdef USE_CURL_ASYNC
data->state.async.dns = dns;
data->state.async.done = TRUE;
#endif
/* Tell a possibly async resolver we no longer need the results. */
Curl_resolver_set_result(data, dns);
infof(data, "Hostname '%s' was found", sx->hostname);
sxstate(sx, data, CONNECT_RESOLVED);
}
@ -814,10 +812,8 @@ CONNECT_REQ_INIT:
dns = Curl_fetch_addr(data, sx->hostname, sx->remote_port);
if(dns) {
#ifdef USE_CURL_ASYNC
data->state.async.dns = dns;
data->state.async.done = TRUE;
#endif
/* Tell a possibly async resolver we no longer need the results. */
Curl_resolver_set_result(data, dns);
infof(data, "SOCKS5: hostname '%s' found", sx->hostname);
}