mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:33:37 +03:00
c-ares: really lazy init channel
Only initialize the c-ares channel when we start resolving and not alreads when the application sets `CURLOPT_DNS_SERVERS` and friends. Creating an ares channel takes considerable time and when we have the DNS information for a transfer already cached, we do not need it. Closes #17167
This commit is contained in:
parent
437c72fbba
commit
7bf576064c
4 changed files with 86 additions and 115 deletions
|
|
@ -2540,25 +2540,25 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option,
|
|||
result = Curl_setstropt(&data->set.str[STRING_DNS_SERVERS], ptr);
|
||||
if(result)
|
||||
return result;
|
||||
return Curl_set_dns_servers(data, data->set.str[STRING_DNS_SERVERS]);
|
||||
return Curl_async_ares_set_dns_servers(data);
|
||||
|
||||
case CURLOPT_DNS_INTERFACE:
|
||||
result = Curl_setstropt(&data->set.str[STRING_DNS_INTERFACE], ptr);
|
||||
if(result)
|
||||
return result;
|
||||
return Curl_set_dns_interface(data, data->set.str[STRING_DNS_INTERFACE]);
|
||||
return Curl_async_ares_set_dns_interface(data);
|
||||
|
||||
case CURLOPT_DNS_LOCAL_IP4:
|
||||
result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP4], ptr);
|
||||
if(result)
|
||||
return result;
|
||||
return Curl_set_dns_local_ip4(data, data->set.str[STRING_DNS_LOCAL_IP4]);
|
||||
return Curl_async_ares_set_dns_local_ip4(data);
|
||||
|
||||
case CURLOPT_DNS_LOCAL_IP6:
|
||||
result = Curl_setstropt(&data->set.str[STRING_DNS_LOCAL_IP6], ptr);
|
||||
if(result)
|
||||
return result;
|
||||
return Curl_set_dns_local_ip6(data, data->set.str[STRING_DNS_LOCAL_IP6]);
|
||||
return Curl_async_ares_set_dns_local_ip6(data);
|
||||
|
||||
#endif
|
||||
#ifdef USE_UNIX_SOCKETS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue