mirror of
https://github.com/curl/curl.git
synced 2025-09-18 01:52:41 +03:00
Gisle cleaned up remaining host resolve re-org issues
This commit is contained in:
parent
cf10df6c68
commit
785bad388b
|
@ -96,8 +96,8 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
#ifdef CURLRES_ASYNCH
|
#ifdef CURLRES_ASYNCH
|
||||||
/*
|
/*
|
||||||
* Curl_addrinfo_callback() gets called by ares/gethostbyname_thread() when we
|
* addrinfo_callback() gets called by ares, gethostbyname_thread() or
|
||||||
* got the name resolved (or not!).
|
* getaddrinfo_thread() when we got the name resolved (or not!).
|
||||||
*
|
*
|
||||||
* If the status argument is CURL_ASYNC_SUCCESS, we might need to copy the
|
* If the status argument is CURL_ASYNC_SUCCESS, we might need to copy the
|
||||||
* address field since it might be freed when this function returns. This
|
* address field since it might be freed when this function returns. This
|
||||||
|
@ -161,9 +161,9 @@ void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
|
||||||
#ifdef CURLRES_IPV6
|
#ifdef CURLRES_IPV6
|
||||||
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
|
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
|
||||||
int status,
|
int status,
|
||||||
struct addrinfo *hostent)
|
struct addrinfo *ai)
|
||||||
{
|
{
|
||||||
addrinfo_callback(arg, status, hostent);
|
addrinfo_callback(arg, status, ai);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ void Curl_addrinfo4_callback(void *arg,
|
||||||
resolve, ipv6 */
|
resolve, ipv6 */
|
||||||
void Curl_addrinfo6_callback(void *arg,
|
void Curl_addrinfo6_callback(void *arg,
|
||||||
int status,
|
int status,
|
||||||
struct hostent *hostent);
|
struct addrinfo *ai);
|
||||||
|
|
||||||
|
|
||||||
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
||||||
|
|
|
@ -111,8 +111,9 @@ void Curl_freeaddrinfo(Curl_addrinfo *p)
|
||||||
* address. But this is an ipv6 build and then we don't copy the address, we
|
* address. But this is an ipv6 build and then we don't copy the address, we
|
||||||
* just return the same pointer!
|
* just return the same pointer!
|
||||||
*/
|
*/
|
||||||
Curl_addrinfo *Curl_addrinfo_copy(Curl_addrinfo *source)
|
Curl_addrinfo *Curl_addrinfo_copy(void *source, int port)
|
||||||
{
|
{
|
||||||
|
(void) port;
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -163,7 +163,7 @@ struct thread_data {
|
||||||
|
|
||||||
#if defined(CURLRES_IPV4)
|
#if defined(CURLRES_IPV4)
|
||||||
/*
|
/*
|
||||||
* gethostbyname_thread() resolves a name, calls the Curl_addrinfo_callback
|
* gethostbyname_thread() resolves a name, calls the Curl_addrinfo4_callback
|
||||||
* and then exits.
|
* and then exits.
|
||||||
*
|
*
|
||||||
* For builds without ARES/ENABLE_IPV6, create a resolver thread and wait on
|
* For builds without ARES/ENABLE_IPV6, create a resolver thread and wait on
|
||||||
|
@ -201,7 +201,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
|
||||||
#elif defined(CURLRES_IPV6)
|
#elif defined(CURLRES_IPV6)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getaddrinfo_thread() resolves a name, calls Curl_addrinfo_callback and then
|
* getaddrinfo_thread() resolves a name, calls Curl_addrinfo6_callback and then
|
||||||
* exits.
|
* exits.
|
||||||
*
|
*
|
||||||
* For builds without ARES, but with ENABLE_IPV6, create a resolver thread
|
* For builds without ARES, but with ENABLE_IPV6, create a resolver thread
|
||||||
|
@ -227,10 +227,10 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
|
||||||
#ifdef DEBUG_THREADING_GETADDRINFO
|
#ifdef DEBUG_THREADING_GETADDRINFO
|
||||||
dump_addrinfo (conn, res);
|
dump_addrinfo (conn, res);
|
||||||
#endif
|
#endif
|
||||||
Curl_addrinfo_callback(conn, CURL_ASYNC_SUCCESS, res);
|
Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Curl_addrinfo_callback(conn, (int)WSAGetLastError(), NULL);
|
Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
|
||||||
TRACE(("Winsock-error %d, no address\n", conn->async.status));
|
TRACE(("Winsock-error %d, no address\n", conn->async.status));
|
||||||
}
|
}
|
||||||
return (rc);
|
return (rc);
|
||||||
|
@ -345,7 +345,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||||
status = WaitForSingleObject(td->thread_hnd, 1000UL*timeout);
|
status = WaitForSingleObject(td->thread_hnd, 1000UL*timeout);
|
||||||
if (status == WAIT_OBJECT_0 || status == WAIT_ABANDONED) {
|
if (status == WAIT_OBJECT_0 || status == WAIT_ABANDONED) {
|
||||||
/* Thread finished before timeout; propagate Winsock error to this thread.
|
/* Thread finished before timeout; propagate Winsock error to this thread.
|
||||||
* 'conn->async.done = TRUE' is set in Curl_addrinfo_callback().
|
* 'conn->async.done = TRUE' is set in Curl_addrinfo4/6_callback().
|
||||||
*/
|
*/
|
||||||
WSASetLastError(conn->async.status);
|
WSASetLastError(conn->async.status);
|
||||||
GetExitCodeThread(td->thread_hnd, &td->thread_status);
|
GetExitCodeThread(td->thread_hnd, &td->thread_status);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user