This commit is contained in:
clowwindy 2014-09-20 19:11:33 +08:00
parent ab74c010fd
commit f677c8152d
2 changed files with 2 additions and 2 deletions

View file

@ -64,7 +64,7 @@ def main():
logging.warn('received SIGQUIT, doing graceful shutting down..')
tcp_server.close(next_tick=True)
udp_server.close(next_tick=True)
signal.signal(signal.SIGQUIT, handler)
signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), handler)
loop.run()
except (KeyboardInterrupt, IOError, OSError) as e:
logging.error(e)

View file

@ -71,7 +71,7 @@ def main():
def child_handler(signum, _):
logging.warn('received SIGQUIT, doing graceful shutting down..')
map(lambda s: s.close(next_tick=True), tcp_servers + udp_servers)
signal.signal(signal.SIGQUIT, child_handler)
signal.signal(getattr(signal, 'SIGQUIT', signal.SIGTERM), child_handler)
try:
loop = eventloop.EventLoop()
dns_resolver.add_to_loop(loop)