Commit b4ecd30b authored by Jim Fulton's avatar Jim Fulton

simplify acceptor setup logic

After reading run_until_complete doc :)
parent edb198a0
......@@ -224,10 +224,8 @@ class Acceptor(object):
cr = loop.create_unix_server(self.factory, addr, ssl=ssl)
f = asyncio.async(cr, loop=loop)
server = loop.run_until_complete(f)
@f.add_done_callback
def listenting(f):
server = f.result()
self.server = server
if isinstance(addr, tuple) and addr[1] == 0:
addrs = [s.getsockname() for s in server.sockets]
......@@ -236,9 +234,8 @@ class Acceptor(object):
self.addr = addrs[0]
else:
self.addr = server.sockets[0].getsockname()[:len(addr)]
logger.info("listening on %s", str(addr))
loop.run_until_complete(f)
logger.info("listening on %s", str(addr))
def factory(self):
try:
......
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