Streamlined the algorithm to eliminate a bug that prevented the event loop from terminating if we got a bad IP address.