diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-06-24 07:43:48 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-06-24 07:43:48 +0000 |
commit | c39858aac0584716282dcb097ce9d972b43dbcb2 (patch) | |
tree | d61866d14e3dd56b0337652a7fddec69fb8f4e90 /lib/hostasyn.c | |
parent | 818aed35e2f7c1602333c0b2ecc0444272966cc7 (diff) | |
download | curl-c39858aac0584716282dcb097ce9d972b43dbcb2.tar.gz |
Source cleanups. The major one being that we now _always_ use a Curl_addrinfo
linked list for name resolved data, even on hosts/systems with only IPv4
stacks as this simplifies a lot of code.
Diffstat (limited to 'lib/hostasyn.c')
-rw-r--r-- | lib/hostasyn.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/lib/hostasyn.c b/lib/hostasyn.c index d308cd17d..da072a043 100644 --- a/lib/hostasyn.c +++ b/lib/hostasyn.c @@ -108,9 +108,9 @@ * * The storage operation locks and unlocks the DNS cache. */ -void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */ - int status, - Curl_addrinfo *hostent) +static void addrinfo_callback(void *arg, /* "struct connectdata *" */ + int status, + void *addr) { struct connectdata *conn = (struct connectdata *)arg; struct Curl_dns_entry *dns = NULL; @@ -126,19 +126,19 @@ void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */ * * IPv6: Curl_addrinfo_copy() returns the input pointer! */ - Curl_addrinfo *he = Curl_addrinfo_copy(hostent); - if(he) { + Curl_addrinfo *ai = Curl_addrinfo_copy(addr, conn->async.port); + if(ai) { struct SessionHandle *data = conn->data; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); - dns = Curl_cache_addr(data, he, + dns = Curl_cache_addr(data, ai, conn->async.hostname, conn->async.port); if(!dns) /* failed to store, cleanup and return error */ - Curl_freeaddrinfo(he); + Curl_freeaddrinfo(ai); if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); @@ -151,4 +151,20 @@ void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */ this function */ } +void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */ + int status, + struct hostent *hostent) +{ + addrinfo_callback(arg, status, hostent); +} + +#ifdef CURLRES_IPV6 +void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */ + int status, + struct addrinfo *hostent) +{ + addrinfo_callback(arg, status, hostent); +} +#endif + #endif /* CURLRES_ASYNC */ |