mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
asynch resolvers: cleanup
Fixed indents, coding conventions and white space edits. Modified the c-ares completion callback function to again NOT read the conn data when the ares handle is being taken down as then it may have been freed already.
This commit is contained in:
parent
ca015f1a45
commit
24d84da073
@ -673,7 +673,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clone the resolver handle, if present, for the new handle */
|
/* Clone the resolver handle, if present, for the new handle */
|
||||||
if( Curl_resolver_duphandle(&outcurl->state.resolver, data->state.resolver) != CURLE_OK )
|
if( Curl_resolver_duphandle(&outcurl->state.resolver,
|
||||||
|
data->state.resolver) != CURLE_OK )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
Curl_convert_setup(outcurl);
|
Curl_convert_setup(outcurl);
|
||||||
|
107
lib/hostares.c
107
lib/hostares.c
@ -104,11 +104,11 @@ struct ResolverResults {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_init() - the generic low-level asynchronous name resolve API.
|
* Curl_resolver_global_init() - the generic low-level asynchronous name
|
||||||
* Called from curl_global_init() to initialize global resolver environment.
|
* resolve API. Called from curl_global_init() to initialize global resolver
|
||||||
* Initializes ares library.
|
* environment. Initializes ares library.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_global_init()
|
int Curl_resolver_global_init(void)
|
||||||
{
|
{
|
||||||
#ifdef CARES_HAVE_ARES_LIBRARY_INIT
|
#ifdef CARES_HAVE_ARES_LIBRARY_INIT
|
||||||
if(ares_library_init(ARES_LIB_INIT_ALL)) {
|
if(ares_library_init(ARES_LIB_INIT_ALL)) {
|
||||||
@ -119,11 +119,12 @@ int Curl_resolver_global_init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_cleanup() - the generic low-level asynchronous name resolve API.
|
* Curl_resolver_global_cleanup()
|
||||||
|
*
|
||||||
* Called from curl_global_cleanup() to destroy global resolver environment.
|
* Called from curl_global_cleanup() to destroy global resolver environment.
|
||||||
* Deinitializes ares library.
|
* Deinitializes ares library.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_global_cleanup()
|
void Curl_resolver_global_cleanup(void)
|
||||||
{
|
{
|
||||||
#ifdef CARES_HAVE_ARES_LIBRARY_CLEANUP
|
#ifdef CARES_HAVE_ARES_LIBRARY_CLEANUP
|
||||||
ares_library_cleanup();
|
ares_library_cleanup();
|
||||||
@ -131,10 +132,11 @@ void Curl_resolver_global_cleanup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_init() - the generic low-level name resolve API.
|
* Curl_resolver_init()
|
||||||
* Called from curl_easy_init() -> Curl_open() to initialize resolver URL-state specific environment
|
*
|
||||||
* ('resolver' member of the UrlState structure).
|
* Called from curl_easy_init() -> Curl_open() to initialize resolver
|
||||||
* Fills the passed pointer by the initialized ares_channel.
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
|
* structure). Fills the passed pointer by the initialized ares_channel.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_init(void **resolver)
|
int Curl_resolver_init(void **resolver)
|
||||||
{
|
{
|
||||||
@ -151,10 +153,11 @@ int Curl_resolver_init(void **resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_cleanup()
|
||||||
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver URL-state specific environment
|
*
|
||||||
* ('resolver' member of the UrlState structure).
|
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
|
||||||
* Destroys the ares channel.
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
|
* structure). Destroys the ares channel.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_cleanup(void *resolver)
|
void Curl_resolver_cleanup(void *resolver)
|
||||||
{
|
{
|
||||||
@ -162,10 +165,11 @@ void Curl_resolver_cleanup(void *resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_duphandle() - the generic low-level name resolve API.
|
* Curl_resolver_duphandle()
|
||||||
* Called from curl_easy_duphandle() to duplicate resolver URL-state specific environment
|
*
|
||||||
* ('resolver' member of the UrlState structure).
|
* Called from curl_easy_duphandle() to duplicate resolver URL-state specific
|
||||||
* Duplicates the 'from' ares channel and passes the resulting channel to the 'to' pointer.
|
* environment ('resolver' member of the UrlState structure). Duplicates the
|
||||||
|
* 'from' ares channel and passes the resulting channel to the 'to' pointer.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_duphandle(void **to, void *from)
|
int Curl_resolver_duphandle(void **to, void *from)
|
||||||
{
|
{
|
||||||
@ -233,7 +237,8 @@ int Curl_resolv_getsock(struct connectdata *conn,
|
|||||||
maxtime.tv_sec = CURL_TIMEOUT_RESOLVE;
|
maxtime.tv_sec = CURL_TIMEOUT_RESOLVE;
|
||||||
maxtime.tv_usec = 0;
|
maxtime.tv_usec = 0;
|
||||||
|
|
||||||
timeout = ares_timeout((ares_channel)conn->data->state.resolver, &maxtime, &timebuf);
|
timeout = ares_timeout((ares_channel)conn->data->state.resolver, &maxtime,
|
||||||
|
&timebuf);
|
||||||
|
|
||||||
Curl_expire(conn->data,
|
Curl_expire(conn->data,
|
||||||
(timeout->tv_sec * 1000) + (timeout->tv_usec/1000));
|
(timeout->tv_sec * 1000) + (timeout->tv_usec/1000));
|
||||||
@ -261,7 +266,8 @@ static int waitperform(struct connectdata *conn, int timeout_ms)
|
|||||||
int i;
|
int i;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
bitmask = ares_getsock((ares_channel)data->state.resolver, socks, ARES_GETSOCK_MAXNUM);
|
bitmask = ares_getsock((ares_channel)data->state.resolver, socks,
|
||||||
|
ARES_GETSOCK_MAXNUM);
|
||||||
|
|
||||||
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
|
for(i=0; i < ARES_GETSOCK_MAXNUM; i++) {
|
||||||
pfd[i].events = 0;
|
pfd[i].events = 0;
|
||||||
@ -288,7 +294,8 @@ static int waitperform(struct connectdata *conn, int timeout_ms)
|
|||||||
if(!nfds)
|
if(!nfds)
|
||||||
/* Call ares_process() unconditonally here, even if we simply timed out
|
/* Call ares_process() unconditonally here, even if we simply timed out
|
||||||
above, as otherwise the ares name resolve won't timeout! */
|
above, as otherwise the ares name resolve won't timeout! */
|
||||||
ares_process_fd((ares_channel)data->state.resolver, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
ares_process_fd((ares_channel)data->state.resolver, ARES_SOCKET_BAD,
|
||||||
|
ARES_SOCKET_BAD);
|
||||||
else {
|
else {
|
||||||
/* move through the descriptors and ask for processing on them */
|
/* move through the descriptors and ask for processing on them */
|
||||||
for(i=0; i < num; i++)
|
for(i=0; i < num; i++)
|
||||||
@ -312,7 +319,8 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
|
|||||||
struct Curl_dns_entry **dns)
|
struct Curl_dns_entry **dns)
|
||||||
{
|
{
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct ResolverResults *res = (struct ResolverResults *)conn->async.os_specific;
|
struct ResolverResults *res = (struct ResolverResults *)
|
||||||
|
conn->async.os_specific;
|
||||||
|
|
||||||
*dns = NULL;
|
*dns = NULL;
|
||||||
|
|
||||||
@ -320,7 +328,8 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
|
|||||||
|
|
||||||
if( res && !res->num_pending ) {
|
if( res && !res->num_pending ) {
|
||||||
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
|
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
|
||||||
/* temp_ai ownership is moved to the connection, so we need not free-up them */
|
/* temp_ai ownership is moved to the connection, so we need not free-up
|
||||||
|
them */
|
||||||
res->temp_ai = NULL;
|
res->temp_ai = NULL;
|
||||||
destroy_async_data(&conn->async);
|
destroy_async_data(&conn->async);
|
||||||
if(!conn->async.dns) {
|
if(!conn->async.dns) {
|
||||||
@ -443,7 +452,8 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Connects results to the list */
|
/* Connects results to the list */
|
||||||
static void ares_compound_results(struct ResolverResults *res, Curl_addrinfo *ai)
|
static void compound_results(struct ResolverResults *res,
|
||||||
|
Curl_addrinfo *ai)
|
||||||
{
|
{
|
||||||
Curl_addrinfo *ai_tail;
|
Curl_addrinfo *ai_tail;
|
||||||
if(!ai)
|
if(!ai)
|
||||||
@ -463,7 +473,7 @@ static void ares_compound_results(struct ResolverResults *res, Curl_addrinfo *ai
|
|||||||
* the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(),
|
* the host query initiated by ares_gethostbyname() from Curl_getaddrinfo(),
|
||||||
* when using ares, is completed either successfully or with failure.
|
* when using ares, is completed either successfully or with failure.
|
||||||
*/
|
*/
|
||||||
static void ares_query_completed_cb(void *arg, /* (struct connectdata *) */
|
static void query_completed_cb(void *arg, /* (struct connectdata *) */
|
||||||
int status,
|
int status,
|
||||||
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
||||||
int timeouts,
|
int timeouts,
|
||||||
@ -471,42 +481,27 @@ static void ares_query_completed_cb(void *arg, /* (struct connectdata *) */
|
|||||||
struct hostent *hostent)
|
struct hostent *hostent)
|
||||||
{
|
{
|
||||||
struct connectdata *conn = (struct connectdata *)arg;
|
struct connectdata *conn = (struct connectdata *)arg;
|
||||||
struct ResolverResults *res = (struct ResolverResults *)conn->async.os_specific;
|
struct ResolverResults *res;
|
||||||
|
|
||||||
if( !conn->data ) {
|
|
||||||
/* Immediately return just because the handle is destroying */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !conn->data->magic ) {
|
|
||||||
/* Immediately return just because the handle is destroying */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !res ) {
|
|
||||||
/* Immediately return just because the results are destroyed for some reason */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
#ifdef HAVE_CARES_CALLBACK_TIMEOUTS
|
||||||
(void)timeouts; /* ignored */
|
(void)timeouts; /* ignored */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(ARES_EDESTRUCTION == status)
|
||||||
|
/* when this ares handle is getting destroyed, the 'arg' pointer may not
|
||||||
|
be valid so only defer it when we know the 'status' says its fine! */
|
||||||
|
return;
|
||||||
|
|
||||||
|
res = (struct ResolverResults *)conn->async.os_specific;
|
||||||
res->num_pending--;
|
res->num_pending--;
|
||||||
|
|
||||||
switch(status) {
|
if(CURL_ASYNC_SUCCESS == status) {
|
||||||
case CURL_ASYNC_SUCCESS:
|
Curl_addrinfo *ai = Curl_he2ai(hostent, conn->async.port);
|
||||||
ares_compound_results(res,Curl_he2ai(hostent, conn->async.port));
|
if(ai) {
|
||||||
break;
|
compound_results(res, ai);
|
||||||
/* this ares handle is getting destroyed, the 'arg' pointer may not be
|
|
||||||
valid! */
|
|
||||||
/* conn->magic check instead
|
|
||||||
case ARES_EDESTRUCTION:
|
|
||||||
return; */
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
/* The successfull result empties any error */
|
}
|
||||||
|
/* A successful result overwrites any previous error */
|
||||||
if( res->last_status != ARES_SUCCESS )
|
if( res->last_status != ARES_SUCCESS )
|
||||||
res->last_status = status;
|
res->last_status = status;
|
||||||
}
|
}
|
||||||
@ -589,9 +584,9 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
|||||||
|
|
||||||
/* areschannel is already setup in the Curl_open() function */
|
/* areschannel is already setup in the Curl_open() function */
|
||||||
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET,
|
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET,
|
||||||
ares_query_completed_cb, conn);
|
query_completed_cb, conn);
|
||||||
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET6,
|
ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET6,
|
||||||
ares_query_completed_cb, conn);
|
query_completed_cb, conn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* CURLRES_IPV6 */
|
#endif /* CURLRES_IPV6 */
|
||||||
@ -600,7 +595,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
|||||||
|
|
||||||
/* areschannel is already setup in the Curl_open() function */
|
/* areschannel is already setup in the Curl_open() function */
|
||||||
ares_gethostbyname((ares_channel)data->state.resolver, hostname, family,
|
ares_gethostbyname((ares_channel)data->state.resolver, hostname, family,
|
||||||
ares_query_completed_cb, conn);
|
query_completed_cb, conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
*waitp = 1; /* expect asynchronous response */
|
*waitp = 1; /* expect asynchronous response */
|
||||||
|
40
lib/hostip.h
40
lib/hostip.h
@ -104,45 +104,53 @@ bool Curl_ipv6works(void);
|
|||||||
*/
|
*/
|
||||||
bool Curl_ipvalid(struct connectdata *conn);
|
bool Curl_ipvalid(struct connectdata *conn);
|
||||||
|
|
||||||
|
/********* functions in the internal asynch resolver interface ****** */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_init() - the generic low-level name resolver API.
|
* Curl_resolver_global_init()
|
||||||
|
*
|
||||||
* Called from curl_global_init() to initialize global resolver environment.
|
* Called from curl_global_init() to initialize global resolver environment.
|
||||||
* Returning anything else than CURLE_OK fails curl_global_init().
|
* Returning anything else than CURLE_OK fails curl_global_init().
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_global_init(void);
|
int Curl_resolver_global_init(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_cleanup() - the generic low-level name resolver API.
|
* Curl_resolver_global_cleanup()
|
||||||
* Called from curl_global_cleanup() to destroy global resolver environment.
|
* Called from curl_global_cleanup() to destroy global resolver environment.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_global_cleanup(void);
|
void Curl_resolver_global_cleanup(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_init() - the generic low-level name resolve API.
|
* Curl_resolver_init()
|
||||||
* Called from curl_easy_init() -> Curl_open() to initialize resolver URL-state specific environment
|
* Called from curl_easy_init() -> Curl_open() to initialize resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Should fill the passed pointer by the initialized handler.
|
* structure). Should fill the passed pointer by the initialized handler.
|
||||||
* Returning anything else than CURLE_OK fails curl_easy_init() with the correspondent code.
|
* Returning anything else than CURLE_OK fails curl_easy_init() with the
|
||||||
|
* correspondent code.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_init(void **resolver);
|
int Curl_resolver_init(void **resolver);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_cleanup()
|
||||||
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver URL-state specific environment
|
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Should destroy the handler and free all resources connected to it.
|
* structure). Should destroy the handler and free all resources connected to
|
||||||
|
* it.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_cleanup(void *resolver);
|
void Curl_resolver_cleanup(void *resolver);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_duphandle() - the generic low-level name resolve API.
|
* Curl_resolver_duphandle()
|
||||||
* Called from curl_easy_duphandle() to duplicate resolver URL-state specific environment
|
* Called from curl_easy_duphandle() to duplicate resolver URL-state specific
|
||||||
* ('resolver' member of the UrlState structure).
|
* environment ('resolver' member of the UrlState structure). Should
|
||||||
* Should duplicate the 'from' handle and pass the resulting handle to the 'to' pointer.
|
* duplicate the 'from' handle and pass the resulting handle to the 'to'
|
||||||
* Returning anything else than CURLE_OK causes failed curl_easy_duphandle() call.
|
* pointer. Returning anything else than CURLE_OK causes failed
|
||||||
|
* curl_easy_duphandle() call.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_duphandle(void **to, void *from);
|
int Curl_resolver_duphandle(void **to, void *from);
|
||||||
|
|
||||||
|
/********** end of generic resolver interface functions *****************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_getaddrinfo() is the generic low-level name resolve API within this
|
* Curl_getaddrinfo() is the generic low-level name resolve API within this
|
||||||
* source file. There are several versions of this function - for different
|
* source file. There are several versions of this function - for different
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2011, 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
|
||||||
@ -73,29 +73,29 @@
|
|||||||
#ifdef CURLRES_SYNCH
|
#ifdef CURLRES_SYNCH
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_init() - the generic low-level name resolve API.
|
* Curl_resolver_global_init()
|
||||||
* Called from curl_global_init() to initialize global resolver environment.
|
* Called from curl_global_init() to initialize global resolver environment.
|
||||||
* Does nothing here.
|
* Does nothing here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_global_init()
|
int Curl_resolver_global_init(void)
|
||||||
{
|
{
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_global_cleanup()
|
||||||
* Called from curl_global_cleanup() to destroy global resolver environment.
|
* Called from curl_global_cleanup() to destroy global resolver environment.
|
||||||
* Does nothing here.
|
* Does nothing here.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_global_cleanup()
|
void Curl_resolver_global_cleanup(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_init() - the generic low-level name resolve API.
|
* Curl_resolver_init()
|
||||||
* Called from curl_easy_init() -> Curl_open() to initialize resolver URL-state specific environment
|
* Called from curl_easy_init() -> Curl_open() to initialize resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Does nothing here.
|
* structure). Does nothing here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_init(void **resolver)
|
int Curl_resolver_init(void **resolver)
|
||||||
{
|
{
|
||||||
@ -104,10 +104,10 @@ int Curl_resolver_init(void **resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_cleanup()
|
||||||
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver URL-state specific environment
|
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Does nothing here.
|
* structure). Does nothing here.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_cleanup(void *resolver)
|
void Curl_resolver_cleanup(void *resolver)
|
||||||
{
|
{
|
||||||
@ -115,10 +115,10 @@ void Curl_resolver_cleanup(void *resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_duphandle() - the generic low-level name resolve API.
|
* Curl_resolver_duphandle()
|
||||||
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific environment
|
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific
|
||||||
* ('resolver' member of the UrlState structure).
|
* environment ('resolver' member of the UrlState structure). Does nothing
|
||||||
* Does nothing here.
|
* here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_duphandle(void **to, void *from)
|
int Curl_resolver_duphandle(void **to, void *from)
|
||||||
{
|
{
|
||||||
|
@ -89,29 +89,29 @@
|
|||||||
#ifdef CURLRES_THREADED
|
#ifdef CURLRES_THREADED
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_init() - the generic low-level name resolve API.
|
* Curl_resolver_global_init()
|
||||||
* Called from curl_global_init() to initialize global resolver environment.
|
* Called from curl_global_init() to initialize global resolver environment.
|
||||||
* Does nothing here.
|
* Does nothing here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_global_init()
|
int Curl_resolver_global_init(void)
|
||||||
{
|
{
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_global_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_global_cleanup()
|
||||||
* Called from curl_global_cleanup() to destroy global resolver environment.
|
* Called from curl_global_cleanup() to destroy global resolver environment.
|
||||||
* Does nothing here.
|
* Does nothing here.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_global_cleanup()
|
void Curl_resolver_global_cleanup(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_init() - the generic low-level name resolve API.
|
* Curl_resolver_init()
|
||||||
* Called from curl_easy_init() -> Curl_open() to initialize resolver URL-state specific environment
|
* Called from curl_easy_init() -> Curl_open() to initialize resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Does nothing here.
|
* structure). Does nothing here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_init(void **resolver)
|
int Curl_resolver_init(void **resolver)
|
||||||
{
|
{
|
||||||
@ -120,10 +120,10 @@ int Curl_resolver_init(void **resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_cleanup() - the generic low-level name resolve API.
|
* Curl_resolver_cleanup()
|
||||||
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver URL-state specific environment
|
* Called from curl_easy_cleanup() -> Curl_close() to cleanup resolver
|
||||||
* ('resolver' member of the UrlState structure).
|
* URL-state specific environment ('resolver' member of the UrlState
|
||||||
* Does nothing here.
|
* structure). Does nothing here.
|
||||||
*/
|
*/
|
||||||
void Curl_resolver_cleanup(void *resolver)
|
void Curl_resolver_cleanup(void *resolver)
|
||||||
{
|
{
|
||||||
@ -131,10 +131,10 @@ void Curl_resolver_cleanup(void *resolver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_resolver_duphandle() - the generic low-level name resolve API.
|
* Curl_resolver_duphandle()
|
||||||
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific environment
|
* Called from curl_easy_duphandle() to duplicate resolver URL state-specific
|
||||||
* ('resolver' member of the UrlState structure).
|
* environment ('resolver' member of the UrlState structure). Does nothing
|
||||||
* Does nothing here.
|
* here.
|
||||||
*/
|
*/
|
||||||
int Curl_resolver_duphandle(void **to, void *from)
|
int Curl_resolver_duphandle(void **to, void *from)
|
||||||
{
|
{
|
||||||
@ -250,8 +250,8 @@ static int getaddrinfo_complete(struct connectdata *conn)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res);
|
rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res);
|
||||||
/* The tsd->res structure has been copied to async.dns and perhaps the DNS cache.
|
/* The tsd->res structure has been copied to async.dns and perhaps the DNS
|
||||||
Set our copy to NULL so destroy_thread_sync_data doesn't free it.
|
cache. Set our copy to NULL so destroy_thread_sync_data doesn't free it.
|
||||||
*/
|
*/
|
||||||
tsd->res = NULL;
|
tsd->res = NULL;
|
||||||
|
|
||||||
|
@ -778,7 +778,8 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
|||||||
|
|
||||||
data->magic = CURLEASY_MAGIC_NUMBER;
|
data->magic = CURLEASY_MAGIC_NUMBER;
|
||||||
|
|
||||||
if( (status=Curl_resolver_init(&data->state.resolver)) != CURLE_OK ) {
|
status = Curl_resolver_init(&data->state.resolver);
|
||||||
|
if(status) {
|
||||||
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
||||||
free(data);
|
free(data);
|
||||||
return status;
|
return status;
|
||||||
|
Loading…
Reference in New Issue
Block a user