Browse Source

signal children

1.4
clowwindy 11 years ago
parent
commit
428de3cf42
  1. 7
      shadowsocks/server.py

7
shadowsocks/server.py

@ -279,6 +279,13 @@ def main():
else: else:
children.append(r) children.append(r)
if not is_child: if not is_child:
def handler(signum, frame):
for pid in children:
os.kill(pid, signum)
os.waitpid(pid, 0)
sys.exit()
import signal
signal.signal(signal.SIGTERM, handler)
# master # master
for child in children: for child in children:
os.waitpid(child, 0) os.waitpid(child, 0)

Loading…
Cancel
Save