clowwindy 10 years ago
parent
commit
f677c8152d
  1. 2
      shadowsocks/local.py
  2. 2
      shadowsocks/server.py

2
shadowsocks/local.py

@ -64,7 +64,7 @@ def main():
logging.warn('received SIGQUIT, doing graceful shutting down..') logging.warn('received SIGQUIT, doing graceful shutting down..')
tcp_server.close(next_tick=True) tcp_server.close(next_tick=True)
udp_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() loop.run()
except (KeyboardInterrupt, IOError, OSError) as e: except (KeyboardInterrupt, IOError, OSError) as e:
logging.error(e) logging.error(e)

2
shadowsocks/server.py

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

Loading…
Cancel
Save