Commit e0da583e authored by Jason Madden's avatar Jason Madden

Use ares_getaddrinfo instead of a hand-built method.

Does not yet handle canonical names, but this doesn't result in test failures.
parent ff3cc4d2
Use ``ares_getaddrinfo`` instead of a manual lookup.
This requires c-ares 1.16.0.
Note that this may change the results, in particular their order.
As part of this, certain parts of the c-ares extension were adapted to As part of this, certain parts of the c-ares extension were adapted to
use modern Cython idioms. use modern Cython idioms.
......
This diff is collapsed.
This diff is collapsed.
...@@ -44,30 +44,31 @@ cdef extern from "ares.h": ...@@ -44,30 +44,31 @@ cdef extern from "ares.h":
int ARES_SOCKET_BAD int ARES_SOCKET_BAD
int ARES_SUCCESS int ARES_SUCCESS
int ARES_ENODATA int ARES_EADDRGETNETWORKPARAMS
int ARES_EFORMERR
int ARES_ESERVFAIL
int ARES_ENOTFOUND
int ARES_ENOTIMP
int ARES_EREFUSED
int ARES_EBADQUERY
int ARES_EBADNAME
int ARES_EBADFAMILY int ARES_EBADFAMILY
int ARES_EBADFLAGS
int ARES_EBADHINTS
int ARES_EBADNAME
int ARES_EBADQUERY
int ARES_EBADRESP int ARES_EBADRESP
int ARES_EBADSTR
int ARES_ECANCELLED
int ARES_ECONNREFUSED int ARES_ECONNREFUSED
int ARES_ETIMEOUT int ARES_EDESTRUCTION
int ARES_EOF
int ARES_EFILE int ARES_EFILE
int ARES_EFORMERR
int ARES_ELOADIPHLPAPI
int ARES_ENODATA
int ARES_ENOMEM int ARES_ENOMEM
int ARES_EDESTRUCTION
int ARES_EBADSTR
int ARES_EBADFLAGS
int ARES_ENONAME int ARES_ENONAME
int ARES_EBADHINTS int ARES_ENOTFOUND
int ARES_ENOTIMP
int ARES_ENOTINITIALIZED int ARES_ENOTINITIALIZED
int ARES_ELOADIPHLPAPI int ARES_EOF
int ARES_EADDRGETNETWORKPARAMS int ARES_EREFUSED
int ARES_ECANCELLED int ARES_ESERVFAIL
int ARES_ESERVICE
int ARES_ETIMEOUT
int ARES_NI_NOFQDN int ARES_NI_NOFQDN
int ARES_NI_NUMERICHOST int ARES_NI_NUMERICHOST
......
...@@ -47,10 +47,15 @@ def trace(message, *args, **kwargs): ...@@ -47,10 +47,15 @@ def trace(message, *args, **kwargs):
util.debug(message, *args, **kwargs) util.debug(message, *args, **kwargs)
def _run(function, *args): def _run(function, *args):
# Things that the stdlib should never raise and neither should we;
# these indicate bugs in our code and we want to raise them.
REAL_ERRORS = (AttributeError, ValueError, NameError)
try: try:
result = function(*args) result = function(*args)
assert not isinstance(result, BaseException), repr(result) assert not isinstance(result, BaseException), repr(result)
return result return result
except REAL_ERRORS:
raise
except Exception as ex: except Exception as ex:
if TRACE: if TRACE:
traceback.print_exc() traceback.print_exc()
...@@ -230,7 +235,7 @@ def add(klass, hostname, name=None, ...@@ -230,7 +235,7 @@ def add(klass, hostname, name=None,
@skipWithoutExternalNetwork("Tries to resolve and compare hostnames/addrinfo") @skipWithoutExternalNetwork("Tries to resolve and compare hostnames/addrinfo")
class TestCase(greentest.TestCase): class TestCase(greentest.TestCase):
maxDiff = None
__timeout__ = 30 __timeout__ = 30
switch_expected = None switch_expected = None
verbose_dns = TRACE verbose_dns = TRACE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment