|
|
@ -37,7 +37,21 @@ class Controller(LoggedClass): |
|
|
|
env = self.env |
|
|
|
loop = self.loop |
|
|
|
|
|
|
|
coros = self.block_processor.coros() |
|
|
|
|
|
|
|
if False: |
|
|
|
self.start_servers() |
|
|
|
coros.append(self.reap_jobs()) |
|
|
|
|
|
|
|
for coro in coros: |
|
|
|
asyncio.ensure_future(coro) |
|
|
|
|
|
|
|
# Signal handlers |
|
|
|
for signame in ('SIGINT', 'SIGTERM'): |
|
|
|
loop.add_signal_handler(getattr(signal, signame), |
|
|
|
partial(self.on_signal, signame)) |
|
|
|
|
|
|
|
def start_servers(self): |
|
|
|
protocol = partial(LocalRPC, self) |
|
|
|
if env.rpc_port is not None: |
|
|
|
host = 'localhost' |
|
|
@ -59,16 +73,6 @@ class Controller(LoggedClass): |
|
|
|
self.logger.info('SSL server listening on {}:{:d}' |
|
|
|
.format(env.host, env.ssl_port)) |
|
|
|
|
|
|
|
coros = self.block_processor.coros() |
|
|
|
|
|
|
|
for coro in coros: |
|
|
|
asyncio.ensure_future(coro) |
|
|
|
|
|
|
|
# Signal handlers |
|
|
|
for signame in ('SIGINT', 'SIGTERM'): |
|
|
|
loop.add_signal_handler(getattr(signal, signame), |
|
|
|
partial(self.on_signal, signame)) |
|
|
|
|
|
|
|
def stop(self): |
|
|
|
'''Close the listening servers.''' |
|
|
|
for server in self.servers: |
|
|
|