Thanks for the comments folks. Chris, I like the idea of moving this
check below the GAI call. Dmitry, that loop is indeed a bit of a code
smell. I'll take care of it. Bernd / Dmitry, thanks for the notes on
AI_CANONNAME. I'll adjust the code and get some testing done then report
back!
I've kept this code as close to the apple version as sensible but the
feedback received so far trumps that.
-Rob
On 05/09/13 22:30, Bernd Eckenfels wrote:
Hello,
I reported before, AI_CANONNAME is used in different places with no
good reason. If you use the flag, the result would be in
res[0].ai_canonname, which is not used. So you can remove it and safe
the elaborate resolving which comes with it.
And I also think the comment "skip DNS lookup" is wrong, as GAI
typically (also) looks in /etc/hosts - and this is also documented in
the mac os man page.
So I think if you remove the flag you dont need the lookupIflocalhost
shortcut at all (or you need it on all systems).
And if you have a look there, I think the AI_ADDRCONFIG should be
considered, instead.
Gruss
Bernd
Am 05.09.2013, 22:33 Uhr, schrieb Dmitry Samersoff
<dmitry.samers...@oracle.com>:
Rob,
Did you try to remove
hints.ai_flags = AI_CANONNAME
this flag asks getaddreinfo to return FQDN, but the function behavior is
not clearly defined for the case where FQDN is not available.