cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cleaning up lib/hostip.c

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Thu, 22 Apr 2004 16:58:37 +0200

"Daniel Stenberg" <daniel-curl_at_haxx.se> said:

> Most of your patch applied cleanly, but I think my edits since hostip2 broke
> the biggest chunk and I don't understand every bit of it. I've uploaded a
> hostip3 package with the now somewhat "crippled" lib/hostthre.c file. Can you
> repatch that file?

Yes, here is a new patch. I take it that the chunk was around 470?
 
> * Does your patch really provide an ipv4-only version too of the threaded
> resolver?

Yes, Curl_init_resolve_thread() spawns THREAD_FUNC which is either
gethostbyname_thread or getaddrinfo_thread. Otherwise the thread
stuff is the same (except for the 'td->hints' used by getaddrinfo).

> * I think we should put the getaddrinfo_callback in hostasyn.c together
> with the ipv4 version (within #ifdef CURLRES_IPV6), since if/when ares
> supports ipv6 it is very likely to use a callback that looks like that as
> well.

Sound good.

BTW. The idna_to_ascii_lz() thingy must be called before Curl_resolv()
(and then use conn->ace_hostname via some macro). Looks like it's after
in hostip3.

And with ENABLE_IPV6, it had to patch:

--- curl-7.12-hostip3/lib/hostip.c Thu Apr 22 13:03:00 2004
+++ hostip.c Thu Apr 22 16:50:43 2004
@@ -537,7 +537,7 @@
 }
 #endif /* CURLRES_HOSTENT_RELOCATE */

-#ifdef CURLRES_ADDRINFO_COPY
+#if defined(CURLRES_ADDRINFO_COPY) && !defined(CURLRES_IPV6)

 /* align on even 64bit boundaries */
 #define MEMALIGN(x) ((x)+(8-(((unsigned long)(x))&0x7)))

since Curl_addrinfo != struct hostent.

--gv

Received on 2004-04-22