Re: [PATCH 5/6] tcp: unify ipv4 and ipv6 code paths
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jun 6, 2011, 10:01 UTC
- Message-ID
- <20110606100147.GN8015@elie>
- In-Reply-To
- <20110606094128.GJ8015@elie>
Jonathan Nieder wrote:
> tells getaddrinfo to restrict attention to TCP > services after this patch. That should make a difference because the > service parameter is NULL.
Sorry, the last sentence should say "That should _not_ make a difference". You would be able to tell the difference between the before and after with "strace git daemon" because of the ai_socktype and ai_protocol settings:
[...]
Show 13 quoted lines
> +int dns_resolve(const char *host, const char *port, int flags,
> + resolver_result *res)
> +{
> + struct addrinfo hints;
> + int gai;
> +
> + memset(&hints, 0, sizeof(hints));
> + if (flags & RESOLVE_CANONNAME)
> + hints.ai_flags = AI_CANONNAME;
> + hints.ai_socktype = SOCK_STREAM;
> + hints.ai_protocol = IPPROTO_TCP;
> +
> + gai = getaddrinfo(host, port, &hints, res);but I don't think the effect is any different --- the ai_socktype and protocol hints are for getservbyname functionality and the code that cares about it was already passing those hints.