From f677c8152d6d399651f9f499ac7a8d487073309c Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sat, 20 Sep 2014 19:11:33 +0800 Subject: [PATCH] close #185 --- shadowsocks/local.py | 2 +- shadowsocks/server.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shadowsocks/local.py b/shadowsocks/local.py index 5aeee3b..be4d66f 100755 --- a/shadowsocks/local.py +++ b/shadowsocks/local.py @@ -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) diff --git a/shadowsocks/server.py b/shadowsocks/server.py index 0b1bfd8..16d39f0 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -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)