Commit 3286f0bb authored by Denis Bilenko's avatar Denis Bilenko

resolver_ares: make Resolver accept options to pass to ares_channel

parent 31651a66
...@@ -10,14 +10,12 @@ class Resolver(object): ...@@ -10,14 +10,12 @@ class Resolver(object):
ares_class = 'gevent.core.ares_channel' ares_class = 'gevent.core.ares_channel'
def __init__(self, hub=None, ares=None): def __init__(self, hub=None, **kwargs):
if hub is None: if hub is None:
hub = get_hub() hub = get_hub()
self.hub = hub self.hub = hub
if ares is None: self.ares_class = _import(self.ares_class)
ares_class = _import(self.ares_class) self.ares = self.ares_class(hub.loop, **kwargs)
ares = ares_class(hub.loop)
self.ares = ares
def gethostbyname(self, hostname, family=AF_INET): def gethostbyname(self, hostname, family=AF_INET):
return self.gethostbyname_ex(hostname, family)[-1][0] return self.gethostbyname_ex(hostname, family)[-1][0]
......
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