Kazu Yamamoto ($B;3K\OBI'(B) <[EMAIL PROTECTED]> writes:
(B
(B> Hello all,
(B>
(B> Thank you for your comments, Hrvoje.
(B>
(B> From: Hrvoje Niksic <[EMAIL PROTECTED]>
(B> Subject: Re: IPv6 support of wget v 1.9.1
(B>
(B>> I guess I don't see the usefulness of the protocol independence, as
(B>> the term is being applied here.  Wget is not protocol-independent, it
(B>> uses TCP and depends on it in various places of the code.
(B>
(B> What our "protocol" refers to is "network layer protocol", not
(B> "transport layer protocol". Only "application layer protocol" which
(B> depends on "network layer protocol" by design is FTP in the context of
(B> "wget".
(B>
(B> So, I don't understand your point here.
(B
(BMy point is that I don't see what we gain by adopting "protocol
(Bindependence".  The current code does assume IPv4/IPv6 and I see no
(Bproblem with it.
(B
(B> If your words "price" and "unnecessary baggage" refers to consumed
(B> memory,
(B
(BThat too, but the point is that passing around sockaddr_storage when
(Ball we need is the address seemed wasteful.  A typical consequence of
(Bthat design is lookup_host() accepting a port number.  Port numbers
(Bdon't affect DNS.  Then there is connect_to_ip having to accept
(Baddrlen.  The previous API at least knew the type (and implicitly
(Blength) of its addresses.
(B
(BBesides, I wanted to support systems without getaddrinfo anyway
(B(preferrably without reimplementing getaddrinfo in the process).
(BHence the whole `ip_address' type.  Now that we have the ip_address
(Btype in place, the need to pass around sockaddr_storage is even
(Bsmaller.
(B
(B> To talk about maintenance stuff, I counted "#if" (or "#ifdef") in the
(B> code:
(B>               original cvs    our code
(B> host.c                19               8
(B> connect.c     27              17
(B
(BBut didn't you remove `--without-ipv6'?  That way you got rid of all
(Bthe #ifdef IPV6, and the count of ifdefs naturally decreased.
(B
(B> I strongly believe that 'the less #if exist, the better".
(B
(BI agree with that, but these ifdefs are not random: they are used in
(Bthe low-level code to support the use of two different API's, and two
(Bsupport decreased code size for people who don't want IPv6 at all.
(BYou will notice that there are no ifdefs in connect_to_host and
(Bconnect_to_ip (actually there's one in the latter, but it is related
(Bto portability.)
(B
(BThe whole point of `host.c' is to provide glue code to low-level API's
(Bsuch as gethostbyname and getaddrinfo (and to add caching).  ifdefs
(Bthat deal with those API differences are the whole point of the file.
(B
(B>> The main idea behind protocol-independent programming is to call
(B>> `connect' with the sockaddr pointer returned by getaddrinfo.  But Wget
(B>> does not do that anyway, so what's the gain?  Do you have a specific
(B>> problem with the current CVS code that you're trying to solve?
(B>
(B> As I mentioned a few times on this list, I'm talking about coding
(B> style.
(B
(BSo style improvement is the principal motivation for your change?  I
(Bassumed that there were other reasons, with the improved style being
(Bjust a benefit.  The people who worked on IPv6 code so far -- myself,
(BThomas, and Mauro -- seem to be satisfied with the current style.
(BDon't get me wrong, noone would say it's perfect, but I do think that
(Bit offers both portability and correctness while being reasonably
(Belegance.
(B
(B"Better" style is often a matter of taste.  Your patch makes some
(Bthings more elegant (it deletes the custom "ip_address" type,
(Bsimplifies the implementation of lookup_host and deletes stuff from
(Bconnect.c), but makes others less elegant (the interface to
(Blookup_host and connect_to_ip, embedding instances of sockaddr_storage
(Binto address_list).  The compromises you chose are not inherently
(Bbetter or worse than ours, they're different.  Personally I prefer the
(Bcurrent approach.

Reply via email to