]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix resolver implementation on Solaris.
authorBen Darnell <ben@bendarnell.com>
Sun, 28 Apr 2013 16:17:00 +0000 (12:17 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 28 Apr 2013 16:17:00 +0000 (12:17 -0400)
Closes #766.

tornado/netutil.py

index 18a84ec582745dcfd8b336b9fc4d55b96583abea..c1ba01b2bd11a7d6d84b20608a677410c7cb42e0 100644 (file)
@@ -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))