diff options
-rw-r--r-- | slixmpp/xmlstream/resolver.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/slixmpp/xmlstream/resolver.py b/slixmpp/xmlstream/resolver.py index f2c3f989..a9c260f0 100644 --- a/slixmpp/xmlstream/resolver.py +++ b/slixmpp/xmlstream/resolver.py @@ -177,9 +177,11 @@ def get_A(host, resolver=None, use_aiodns=True): # If not using aiodns, attempt lookup using the OS level # getaddrinfo() method. if resolver is None or not use_aiodns: + loop = asyncio.get_event_loop() try: - recs = socket.getaddrinfo(host, None, socket.AF_INET, - socket.SOCK_STREAM) + recs = yield from loop.getaddrinfo(host, None, + family=socket.AF_INET, + type=socket.SOCK_STREAM) return [rec[4][0] for rec in recs] except socket.gaierror: log.debug("DNS: Error retrieving A address info for %s." % host) @@ -222,9 +224,11 @@ def get_AAAA(host, resolver=None, use_aiodns=True): if not socket.has_ipv6: log.debug("DNS: Unable to query %s for AAAA records: IPv6 is not supported", host) return [] + loop = asyncio.get_event_loop() try: - recs = socket.getaddrinfo(host, None, socket.AF_INET6, - socket.SOCK_STREAM) + recs = yield from loop.getaddrinfo(host, None, + family=socket.AF_INET6, + type=socket.SOCK_STREAM) return [rec[4][0] for rec in recs] except (OSError, socket.gaierror): log.debug("DNS: Error retreiving AAAA address " + \ |