MCPcopy
hub / github.com/tornadoweb/tornado / _resolve_addr

Function _resolve_addr

tornado/netutil.py:391–403  ·  view source on GitHub ↗
(
    host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC
)

Source from the content-addressed store, hash-verified

389
390
391def _resolve_addr(
392 host: str, port: int, family: socket.AddressFamily = socket.AF_UNSPEC
393) -> List[Tuple[int, Any]]:
394 # On Solaris, getaddrinfo fails if the given port is not found
395 # in /etc/services and no socket type is given, so we must pass
396 # one here. The socket type used here doesn't seem to actually
397 # matter (we discard the one we get back in the results),
398 # so the addresses we return should still be usable with SOCK_DGRAM.
399 addrinfo = socket.getaddrinfo(host, port, family, socket.SOCK_STREAM)
400 results = []
401 for fam, socktype, proto, canonname, address in addrinfo:
402 results.append((fam, address))
403 return results # type: ignore
404
405
406class DefaultExecutorResolver(Resolver):

Callers 1

resolveMethod · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected