From bfc4c33985aa40557a7b48d8052577b0c8bd0c5c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 22 Jan 2010 06:36:52 +0000 Subject: Constantine Sapuntzakis refactoring of async callbacks, allowing removal of Curl_addrinfo_copy(), Curl_addrinfo6_callback(), and Curl_addrinfo4_callback() --- lib/hostip.h | 44 ++++++++++---------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) (limited to 'lib/hostip.h') diff --git a/lib/hostip.h b/lib/hostip.h index b6aef623a..e987f301e 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -65,23 +65,10 @@ #define CURLRES_IPV4 #endif -#if defined(CURLRES_IPV4) || defined(CURLRES_ARES) -#if !defined(HAVE_GETHOSTBYNAME_R) || defined(CURLRES_ASYNCH) -/* If built for ipv4 and missing gethostbyname_r(), or if using async name - resolve, we need the Curl_addrinfo_copy() function (which itself needs the - Curl_he2ai() function)) */ -#define CURLRES_ADDRINFO_COPY -#endif -#endif /* IPv4/ares-only */ - #ifndef CURLRES_ASYNCH #define CURLRES_SYNCH #endif -#ifndef USE_LIBIDN -#define CURLRES_IDN -#endif - /* Allocate enough memory to hold the full name information structs and * everything. OSF1 is known to require at least 8872 bytes. The buffer * required for storing all possible aliases and IP numbers is according to @@ -203,26 +190,15 @@ int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa, int line, const char *source); #endif -/* This is the callback function that is used when we build with asynch - resolve, ipv4 */ -CURLcode Curl_addrinfo4_callback(void *arg, - int status, -#ifdef HAVE_CARES_CALLBACK_TIMEOUTS - int timeouts, -#endif - struct hostent *hostent); -/* This is the callback function that is used when we build with asynch - resolve, ipv6 */ -CURLcode Curl_addrinfo6_callback(void *arg, - int status, -#ifdef HAVE_CARES_CALLBACK_TIMEOUTS - int timeouts, -#endif - Curl_addrinfo *ai); - - -/* Clone a Curl_addrinfo struct, works protocol independently */ -Curl_addrinfo *Curl_addrinfo_copy(const void *orig, int port); +/* + * Curl_addrinfo_callback() is used when we build with any asynch specialty. + * Handles end of async request processing. Inserts ai into hostcache when + * status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async + * request completed wether successfull or failed. + */ +CURLcode Curl_addrinfo_callback(struct connectdata *conn, + int status, + Curl_addrinfo *ai); /* * Curl_printable_address() returns a printable version of the 1st address -- cgit v1.2.1