From 2672a6378e659707720206aa3f64ebc7023ff3c0 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 1 Jun 2014 17:20:51 +0800 Subject: [PATCH] fix ctrl C --- shadowsocks/server.py | 5 +++++ test/aes.json | 2 +- test/salsa20.json | 2 +- test/server-multi-passwd.json | 2 +- test/table.json | 2 +- test/workers.json | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/shadowsocks/server.py b/shadowsocks/server.py index d3e384f..b9b897e 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -66,6 +66,11 @@ def main(): tcp_server.start() for udp_server in udp_servers: udp_server.start() + try: + while sys.stdin.read(): + pass + except KeyboardInterrupt: + os._exit(0) if int(config['workers']) > 1: if os.name == 'posix': diff --git a/test/aes.json b/test/aes.json index 42ba376..cc9ffeb 100644 --- a/test/aes.json +++ b/test/aes.json @@ -1,7 +1,7 @@ { "server":"127.0.0.1", "server_port":8388, - "local_port":1080, + "local_port":1081, "password":"barfoo!", "timeout":300, "method":"aes-256-cfb", diff --git a/test/salsa20.json b/test/salsa20.json index 8035f06..182589e 100644 --- a/test/salsa20.json +++ b/test/salsa20.json @@ -1,7 +1,7 @@ { "server":"127.0.0.1", "server_port":8388, - "local_port":1080, + "local_port":1081, "password":"barfoo!", "timeout":300, "method":"salsa20-ctr", diff --git a/test/server-multi-passwd.json b/test/server-multi-passwd.json index 2c0609e..497c60a 100644 --- a/test/server-multi-passwd.json +++ b/test/server-multi-passwd.json @@ -1,7 +1,7 @@ { "server": "127.0.0.1", "server_port": 8384, - "local_port": 1080, + "local_port": 1081, "password": "foobar4", "port_password": { "8381": "foobar1", diff --git a/test/table.json b/test/table.json index 4b1c984..402a4b8 100644 --- a/test/table.json +++ b/test/table.json @@ -1,7 +1,7 @@ { "server":"127.0.0.1", "server_port":8388, - "local_port":1080, + "local_port":1081, "password":"barfoo!", "timeout":300, "method":"table", diff --git a/test/workers.json b/test/workers.json index c3d699b..1df28ce 100644 --- a/test/workers.json +++ b/test/workers.json @@ -1,7 +1,7 @@ { "server":"127.0.0.1", "server_port":8388, - "local_port":1080, + "local_port":1081, "password":"barfoo!", "timeout":300, "method":"aes-256-cfb",