From 46f3fe0e75aa4cd1ae057b3703a6ddd272356813 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 Sep 2022 08:52:57 +0200 Subject: hostip: lazily wait to figure out if IPv6 works until needed The check may take many milliseconds, so now it is performed once the value is first needed. Also, this change makes sure that the value is not used if the resolve is set to be IPv4-only. Closes #9553 --- lib/asyn-thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/asyn-thread.c') diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 68fddf0b2..8b375eb5e 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -707,7 +707,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data, *waitp = 0; /* default to synchronous response */ #ifdef CURLRES_IPV6 - if(Curl_ipv6works(data) && data->conn->ip_version != CURL_IPRESOLVE_V4) + if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) /* The stack seems to be IPv6-enabled */ pf = PF_UNSPEC; #endif /* CURLRES_IPV6 */ -- cgit v1.2.1