Adapted the c-ares code to the API change c-ares 1.5.0 brings in the

notifier callback(s).
This commit is contained in:
Daniel Stenberg
2007-09-28 21:48:28 +00:00
parent bb667c8ac6
commit 2c105af910
4 changed files with 32 additions and 1 deletions

View File

@@ -6,6 +6,10 @@
Changelog Changelog
Daniel S (28 September 2007)
- Adapted the c-ares code to the API change c-ares 1.5.0 brings in the
notifier callback(s).
Dan F (26 September 2007) Dan F (26 September 2007)
- Enabled a few more gcc warnings with --enable-debug. Renamed a few - Enabled a few more gcc warnings with --enable-debug. Renamed a few
variables to avoid shadowing global declarations. variables to avoid shadowing global declarations.

View File

@@ -15,6 +15,7 @@ This release includes the following changes:
o improved NSS support o improved NSS support
o added --proxy-negotiate o added --proxy-negotiate
o added --post301 and CURLOPT_POST301 o added --post301 and CURLOPT_POST301
o builds with c-ares 1.5.0
This release includes the following bugfixes: This release includes the following bugfixes:

View File

@@ -151,19 +151,31 @@ static CURLcode addrinfo_callback(void *arg, /* "struct connectdata *" */
CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */ CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
int status, int status,
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
int timeouts,
#endif
struct hostent *hostent) struct hostent *hostent)
{ {
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
(void)timeouts; /* ignored */
#endif
return addrinfo_callback(arg, status, hostent); return addrinfo_callback(arg, status, hostent);
} }
#ifdef CURLRES_IPV6 #ifdef CURLRES_IPV6
CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */ CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
int status, int status,
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
int timeouts,
#endif
struct addrinfo *ai) struct addrinfo *ai)
{ {
/* NOTE: for CURLRES_ARES, the 'ai' argument is really a /* NOTE: for CURLRES_ARES, the 'ai' argument is really a
* 'struct hostent' pointer. * 'struct hostent' pointer.
*/ */
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
(void)timeouts; /* ignored */
#endif
return addrinfo_callback(arg, status, ai); return addrinfo_callback(arg, status, ai);
} }
#endif #endif

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -35,6 +35,10 @@
* Setup comfortable CURLRES_* defines to use in the host*.c sources. * Setup comfortable CURLRES_* defines to use in the host*.c sources.
*/ */
#ifdef USE_ARES
#include <ares_version.h>
#endif
#ifdef USE_ARES #ifdef USE_ARES
#define CURLRES_ASYNCH #define CURLRES_ASYNCH
#define CURLRES_ARES #define CURLRES_ARES
@@ -85,6 +89,10 @@
#ifdef CURLRES_ARES #ifdef CURLRES_ARES
#define CURL_ASYNC_SUCCESS ARES_SUCCESS #define CURL_ASYNC_SUCCESS ARES_SUCCESS
#if ARES_VERSION >= 0x010500
/* c-ares 1.5.0 or later, the callback proto is modified */
#define HAVE_CARES_CALLBACK_TIMEOUTS 1
#endif
#else #else
#define CURL_ASYNC_SUCCESS CURLE_OK #define CURL_ASYNC_SUCCESS CURLE_OK
#define ares_cancel(x) do {} while(0) #define ares_cancel(x) do {} while(0)
@@ -216,11 +224,17 @@ int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
resolve, ipv4 */ resolve, ipv4 */
CURLcode Curl_addrinfo4_callback(void *arg, CURLcode Curl_addrinfo4_callback(void *arg,
int status, int status,
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
int timeouts,
#endif
struct hostent *hostent); struct hostent *hostent);
/* This is the callback function that is used when we build with asynch /* This is the callback function that is used when we build with asynch
resolve, ipv6 */ resolve, ipv6 */
CURLcode Curl_addrinfo6_callback(void *arg, CURLcode Curl_addrinfo6_callback(void *arg,
int status, int status,
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
int timeouts,
#endif
struct addrinfo *ai); struct addrinfo *ai);