Browse Source

do not check config for daemon stop

master
clowwindy 10 years ago
parent
commit
73f21ffbf6
  1. 3
      shadowsocks/daemon.py
  2. 10
      shadowsocks/utils.py

3
shadowsocks/daemon.py

@ -43,9 +43,6 @@ def daemon_exec(config):
command = 'start' command = 'start'
pid_file = config['pid-file'] pid_file = config['pid-file']
log_file = config['log-file'] log_file = config['log-file']
command = common.to_str(command)
pid_file = common.to_str(pid_file)
log_file = common.to_str(log_file)
if command == 'start': if command == 'start':
daemon_start(pid_file, log_file) daemon_start(pid_file, log_file)
elif command == 'stop': elif command == 'stop':

10
shadowsocks/utils.py

@ -70,6 +70,10 @@ def find_config():
def check_config(config): def check_config(config):
if config.get('daemon', None) == 'stop':
# no need to specify configuration for daemon stop
return
if config.get('local_address', '') in [b'0.0.0.0']: if config.get('local_address', '') in [b'0.0.0.0']:
logging.warn('warning: local set to listen on 0.0.0.0, it\'s not safe') logging.warn('warning: local set to listen on 0.0.0.0, it\'s not safe')
if config.get('server', '') in [b'127.0.0.1', b'localhost']: if config.get('server', '') in [b'127.0.0.1', b'localhost']:
@ -165,11 +169,11 @@ def get_config(is_local):
print_server_help() print_server_help()
sys.exit(0) sys.exit(0)
elif key == '-d': elif key == '-d':
config['daemon'] = value config['daemon'] = to_str(value)
elif key == '--pid-file': elif key == '--pid-file':
config['pid-file'] = value config['pid-file'] = to_str(value)
elif key == '--log-file': elif key == '--log-file':
config['log-file'] = value config['log-file'] = to_str(value)
elif key == '-q': elif key == '-q':
v_count -= 1 v_count -= 1
config['verbose'] = v_count config['verbose'] = v_count

Loading…
Cancel
Save