mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:43:38 +03:00
hostip: remove conn->data from resolver functions
This also moves the 'async' struct from the connectdata struct into the Curl_easy struct, which seems like a better home for it. Closes #6497
This commit is contained in:
parent
d3a3bdb5ef
commit
8335c6417e
18 changed files with 242 additions and 254 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -66,25 +66,23 @@
|
|||
*
|
||||
* The storage operation locks and unlocks the DNS cache.
|
||||
*/
|
||||
CURLcode Curl_addrinfo_callback(struct connectdata *conn,
|
||||
CURLcode Curl_addrinfo_callback(struct Curl_easy *data,
|
||||
int status,
|
||||
struct Curl_addrinfo *ai)
|
||||
{
|
||||
struct Curl_dns_entry *dns = NULL;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
conn->async.status = status;
|
||||
data->state.async.status = status;
|
||||
|
||||
if(CURL_ASYNC_SUCCESS == status) {
|
||||
if(ai) {
|
||||
struct Curl_easy *data = conn->data;
|
||||
|
||||
if(data->share)
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
dns = Curl_cache_addr(data, ai,
|
||||
conn->async.hostname,
|
||||
conn->async.port);
|
||||
data->state.async.hostname,
|
||||
data->state.async.port);
|
||||
if(data->share)
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||
|
||||
|
|
@ -99,12 +97,12 @@ CURLcode Curl_addrinfo_callback(struct connectdata *conn,
|
|||
}
|
||||
}
|
||||
|
||||
conn->async.dns = dns;
|
||||
data->state.async.dns = dns;
|
||||
|
||||
/* Set async.done TRUE last in this function since it may be used multi-
|
||||
threaded and once this is TRUE the other thread may read fields from the
|
||||
async struct */
|
||||
conn->async.done = TRUE;
|
||||
data->state.async.done = TRUE;
|
||||
|
||||
/* IPv4: The input hostent struct will be freed by ares when we return from
|
||||
this function */
|
||||
|
|
@ -117,12 +115,12 @@ CURLcode Curl_addrinfo_callback(struct connectdata *conn,
|
|||
* name resolve layers (selected at build-time). They all take this same set
|
||||
* of arguments
|
||||
*/
|
||||
struct Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
struct Curl_addrinfo *Curl_getaddrinfo(struct Curl_easy *data,
|
||||
const char *hostname,
|
||||
int port,
|
||||
int *waitp)
|
||||
{
|
||||
return Curl_resolver_getaddrinfo(conn, hostname, port, waitp);
|
||||
return Curl_resolver_getaddrinfo(data, hostname, port, waitp);
|
||||
}
|
||||
|
||||
#endif /* CURLRES_ASYNCH */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue