From 262652992da659d6821ab1a250de0dffe6a6beaf Mon Sep 17 00:00:00 2001 From: Jake Basile Date: Thu, 18 Jul 2013 08:25:28 -0500 Subject: Caught OSError when querying AAAA records. --- sleekxmpp/xmlstream/resolver.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sleekxmpp/xmlstream') diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py index 16f8a7ad..75ba50d1 100644 --- a/sleekxmpp/xmlstream/resolver.py +++ b/sleekxmpp/xmlstream/resolver.py @@ -210,6 +210,10 @@ def get_AAAA(host, resolver=None): log.debug("DNS: Error retreiving AAAA address " + \ "info for %s." % host) return [] + except OSError: + log.debug("DNS: Error retreiving AAAA address " + \ + "info for %s." % host) + return [] # Using dnspython: try: -- cgit v1.2.3 From cc81a0e8daf1253d390a5bfae1e7157f3f3f8f3e Mon Sep 17 00:00:00 2001 From: Jake Basile Date: Thu, 18 Jul 2013 13:07:25 -0500 Subject: DRYed up the OSError/socket.gaierror handler. --- sleekxmpp/xmlstream/resolver.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sleekxmpp/xmlstream') diff --git a/sleekxmpp/xmlstream/resolver.py b/sleekxmpp/xmlstream/resolver.py index 75ba50d1..4cac254c 100644 --- a/sleekxmpp/xmlstream/resolver.py +++ b/sleekxmpp/xmlstream/resolver.py @@ -206,11 +206,7 @@ def get_AAAA(host, resolver=None): recs = socket.getaddrinfo(host, None, socket.AF_INET6, socket.SOCK_STREAM) return [rec[4][0] for rec in recs] - except socket.gaierror: - log.debug("DNS: Error retreiving AAAA address " + \ - "info for %s." % host) - return [] - except OSError: + except (OSError, socket.gaierror): log.debug("DNS: Error retreiving AAAA address " + \ "info for %s." % host) return [] -- cgit v1.2.3