Avoid leaking timers when doing DNS resolution

Previously, EM would start a timer whenever it connected to a DNS server and never stop that timer.

Instead, only start the timer when a request is sent (meaning that the timer isn't started when connecting to the DNS server if the result is answerable from /etc/hosts), and stop it when there are no further pending requests.

Based on patches by Greg Brockman <gdb@stripe.com>