keithw/mosh — pull request #455 by maltek (2013-08-23 12:03:06+00:00)
Title: look for updated DNS when connection to server is lost

I implemented issue 212:
Instead of resolving the host name in the mosh wrapper script and giving the mosh-client the resolved IPv4 address, I modified the script to pass down the host name, then changed the client to constantly re-resolve that host name when the connection is lost.

To do so, I modified Connection::hop_port() to make an asynchronous DNS request. The DNS requests are IPv4 only right now, but I used getaddrinfo, so changing it to support IPv6 should not be too hard.

Only GNU libc has an asynchronus getaddrinfo_a, so I had to use pthreads to make one.

Note also that I changed AC_CHECK_FUNCS to spit out an error message when a function isn't found, otherwise the missing getaddrinfo would just be ignored. I'm by far not an automake expert, so I'm not 100% sure this doesn't break anything.

I tested this patch on Linux, OS X and FreeBSD x86_64.