Commit 04fa3939 authored by Denis Bilenko's avatar Denis Bilenko

resolver_ares: take advantage of "ref" feature

parent 7a664a5e
......@@ -21,9 +21,8 @@ class Resolver(object):
self.ares = self.ares_class(hub.loop, **kwargs)
self.pid = os.getpid()
self.params = kwargs
self.fork_watcher = hub.loop.fork()
self.fork_watcher = hub.loop.fork(ref=False)
self.fork_watcher.start(self._on_fork)
self.fork_watcher.loop.unref()
def __repr__(self):
return '<%s at 0x%x ares=%r>' % (self.__class__.__name__, id(self), self.ares)
......@@ -39,9 +38,7 @@ class Resolver(object):
if self.ares is not None:
self.hub.loop.run_callback(self.ares.destroy)
self.ares = None
if self.fork_watcher.active:
self.fork_watcher.stop()
self.fork_watcher.loop.ref()
self.fork_watcher.stop()
def gethostbyname(self, hostname, family=AF_INET):
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