mirror of
https://github.com/curl/curl.git
synced 2026-08-24 22:43:38 +03:00
dns_entry: move from conn to data->state
The `struct Curl_dns_entry *` used to established a connection do not have the connection's lifetime, but the transfer's lifetime (of the transfer that initiates the connect). `Curl_dns_entry *` is reference counted with the "dns cache". That cache might be owned by the multi or the transfer's share. In the share, the reference count needs updating under lock. Therefore, the dns entry can only be kept *and* released using the same transfer it was initially looked up from. But a connection is often discarded using another transfer. So far, the problem of this has been avoided in clearing the connection's dns entries in the "multi_don()" handling. So, connections had NULL dns entries after the initial transfers and its connect had been handled. Keeping the dns entries in data->state seems therefore a better choice. Also: remove the `struct Curl_dns_entry *` from the connect filters contexts. Use `data->state.dns` every time instead and fail correctly when not present and needed. Closes #17383
This commit is contained in:
parent
3ec6aa5c07
commit
be45e014c6
14 changed files with 132 additions and 119 deletions
|
|
@ -753,12 +753,6 @@ struct connectdata {
|
|||
* the connection is cleaned up (see Curl_hash_add2()).*/
|
||||
struct Curl_hash meta_hash;
|
||||
|
||||
/* 'dns_entry' is the particular host we use. This points to an entry in the
|
||||
DNS cache and it will not get pruned while locked. It gets unlocked in
|
||||
multi_done(). This entry will be NULL if the connection is reused as then
|
||||
there is no name resolve done. */
|
||||
struct Curl_dns_entry *dns_entry;
|
||||
|
||||
/* 'remote_addr' is the particular IP we connected to. it is owned, set
|
||||
* and NULLed by the connected socket filter (if there is one). */
|
||||
const struct Curl_sockaddr_ex *remote_addr;
|
||||
|
|
@ -1150,6 +1144,8 @@ struct UrlState {
|
|||
#endif
|
||||
struct auth authhost; /* auth details for host */
|
||||
struct auth authproxy; /* auth details for proxy */
|
||||
|
||||
struct Curl_dns_entry *dns[2]; /* DNS to connect FIRST/SECONDARY */
|
||||
#ifdef USE_CURL_ASYNC
|
||||
struct Curl_async async; /* asynchronous name resolver data */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue