From: Daniel Stenberg Date: Mon, 28 Aug 2023 14:07:34 +0000 (+0200) Subject: asyn-ares: reduce timeout to 2000ms X-Git-Tag: curl-8_3_0~88 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a181b4a053339c0713f9c31c724f15ec5beb8d56;p=thirdparty%2Fcurl.git asyn-ares: reduce timeout to 2000ms When UDP packets get lost this makes for slightly faster retries. This lower timeout is used by @c-ares itself by default starting next release. Closes #11753 --- diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 3e0e949681..e73e41dab9 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -110,7 +110,7 @@ struct thread_data { }; /* How long we are willing to wait for additional parallel responses after - obtaining a "definitive" one. + obtaining a "definitive" one. For old c-ares without getaddrinfo. This is intended to equal the c-ares default timeout. cURL always uses that default value. Unfortunately, c-ares doesn't expose its default timeout in @@ -120,6 +120,8 @@ struct thread_data { */ #define HAPPY_EYEBALLS_DNS_TIMEOUT 5000 +#define CARES_TIMEOUT_PER_ATTEMPT 2000 + /* * Curl_resolver_global_init() - the generic low-level asynchronous name * resolve API. Called from curl_global_init() to initialize global resolver @@ -173,6 +175,9 @@ CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver) int optmask = ARES_OPT_SOCK_STATE_CB; options.sock_state_cb = sock_state_cb; options.sock_state_cb_data = easy; + options.timeout = CARES_TIMEOUT_PER_ATTEMPT; + optmask |= ARES_OPT_TIMEOUTMS; + status = ares_init_options((ares_channel*)resolver, &options, optmask); if(status != ARES_SUCCESS) { if(status == ARES_ENOMEM)