diff --git a/config.json b/config.json index 988100f..55f12b5 100644 --- a/config.json +++ b/config.json @@ -15,6 +15,7 @@ "speed_limit_per_user": 0, "additional_ports" : {}, // only works under multi-user mode + "additional_ports_only" : false, // only works under multi-user mode "timeout": 120, "udp_timeout": 60, "dns_ipv6": false, diff --git a/db_transfer.py b/db_transfer.py index a5fb862..17a28fc 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -152,8 +152,9 @@ class TransferBase(object): else: self.new_server(port, passwd, cfg) else: + config = shell.get_config(False) if ServerPool.get_instance().server_is_run(port) > 0: - if not allow: + if config['additional_ports_only'] or not allow: logging.info('db stop server at port [%s]' % (port,)) ServerPool.get_instance().cb_del_server(port) self.force_update_transfer.add(port) @@ -164,7 +165,7 @@ class TransferBase(object): self.force_update_transfer.add(port) new_servers[port] = (passwd, cfg) - elif allow and port > 0 and port < 65536 and ServerPool.get_instance().server_run_status(port) is False: + elif not config['additional_ports_only'] and allow and port > 0 and port < 65536 and ServerPool.get_instance().server_run_status(port) is False: self.new_server(port, passwd, cfg) for row in last_rows: diff --git a/shadowsocks/shell.py b/shadowsocks/shell.py index 1540412..f0e0cb0 100755 --- a/shadowsocks/shell.py +++ b/shadowsocks/shell.py @@ -245,6 +245,7 @@ def get_config(is_local): config['obfs_param'] = to_str(config.get('obfs_param', '')) config['port_password'] = config.get('port_password', None) config['additional_ports'] = config.get('additional_ports', {}) + config['additional_ports_only'] = config.get('additional_ports_only', False) config['timeout'] = int(config.get('timeout', 300)) config['udp_timeout'] = int(config.get('udp_timeout', 120)) config['udp_cache'] = int(config.get('udp_cache', 64))