From: Ben Darnell Date: Sun, 28 Apr 2013 16:17:00 +0000 (-0400) Subject: Fix resolver implementation on Solaris. X-Git-Tag: v3.1.0~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=520b02f3a30f95fa9a3f2636b6ba2e5c9a76a99a;p=thirdparty%2Ftornado.git Fix resolver implementation on Solaris. Closes #766. --- diff --git a/tornado/netutil.py b/tornado/netutil.py index 18a84ec58..c1ba01b2b 100644 --- a/tornado/netutil.py +++ b/tornado/netutil.py @@ -215,7 +215,12 @@ class ExecutorResolver(Resolver): @run_on_executor def resolve(self, host, port, family=socket.AF_UNSPEC): - addrinfo = socket.getaddrinfo(host, port, family) + # On Solaris, getaddrinfo fails if the given port is not found + # in /etc/services and no socket type is given, so we must pass + # one here. The socket type used here doesn't seem to actually + # matter (we discard the one we get back in the results), + # so the addresses we return should still be usable with SOCK_DGRAM. + addrinfo = socket.getaddrinfo(host, port, family, socket.SOCK_STREAM) results = [] for family, socktype, proto, canonname, address in addrinfo: results.append((family, address))