try:
self.socket.connect(address)
except socket.error, e:
- # In non-blocking mode connect() always raises an exception
+ # In non-blocking mode we expect connect() to raise an
+ # exception with EINPROGRESS or EWOULDBLOCK.
+ #
+ # On freebsd, other errors such as ECONNREFUSED may be
+ # returned immediately when attempting to connect to
+ # localhost, so handle them the same way as an error
+ # reported later in _handle_connect.
if e.args[0] not in (errno.EINPROGRESS, errno.EWOULDBLOCK):
- raise
+ logging.warning("Connect error on fd %d: %s",
+ self.socket.fileno(), e)
+ self.close()
+ return
self._connect_callback = stack_context.wrap(callback)
self._add_io_state(self.io_loop.WRITE)
self.assertEqual(str(response.error), "HTTP 599: Timeout")
def test_ipv6(self):
+ if not socket.has_ipv6:
+ # python compiled without ipv6 support, so skip this test
+ return
try:
self.http_server.listen(self.get_http_port(), address='::1')
except socket.gaierror, e:
if e.errno == socket.EAI_ADDRFAMILY:
- # ipv6 is not configured on this system, so skip this test
+ # python supports ipv6, but it's not configured on the network
+ # interface, so skip this test.
return
raise
url = self.get_url("/hello").replace("localhost", "[::1]")