From 09b5a99816a24a12f769f61db5f7eafd4bc32795 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 20 Aug 2014 23:31:53 +0200 Subject: resolve: cache lookup for async resolvers While waiting for a host resolve, check if the host cache may have gotten the name already (by someone else), for when the same name is resolved by several simultanoues requests. The resolver thread occasionally gets stuck in getaddrinfo() when the DNS or anything else is crappy or slow, so when a host is found in the DNS cache, leave the thread alone and let itself cleanup the mess. --- lib/hostip.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/hostip.h') diff --git a/lib/hostip.h b/lib/hostip.h index 42ed7d320..440465194 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -171,6 +171,17 @@ CURLcode Curl_addrinfo_callback(struct connectdata *conn, const char *Curl_printable_address(const Curl_addrinfo *ip, char *buf, size_t bufsize); +/* + * Curl_fetch_addr() fetches a 'Curl_dns_entry' already in the DNS cache. + * + * Returns the Curl_dns_entry entry pointer or NULL if not in the cache. + */ +struct Curl_dns_entry * +Curl_fetch_addr(struct connectdata *conn, + const char *hostname, + int port, + int *stale); + /* * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. * -- cgit v1.2.3