|
@ -124,7 +124,7 @@ class DbTransfer(object): |
|
|
|
|
|
|
|
|
port = row['port'] |
|
|
port = row['port'] |
|
|
passwd = common.to_bytes(row['passwd']) |
|
|
passwd = common.to_bytes(row['passwd']) |
|
|
cfg = {} |
|
|
cfg = {'password': passwd} |
|
|
for name in ['method', 'obfs', 'protocol']: |
|
|
for name in ['method', 'obfs', 'protocol']: |
|
|
if name in row: |
|
|
if name in row: |
|
|
cfg[name] = row[name] |
|
|
cfg[name] = row[name] |
|
@ -139,12 +139,25 @@ class DbTransfer(object): |
|
|
if not allow: |
|
|
if not allow: |
|
|
logging.info('db stop server at port [%s]' % (port,)) |
|
|
logging.info('db stop server at port [%s]' % (port,)) |
|
|
ServerPool.get_instance().cb_del_server(port) |
|
|
ServerPool.get_instance().cb_del_server(port) |
|
|
elif (port in ServerPool.get_instance().tcp_servers_pool and ServerPool.get_instance().tcp_servers_pool[port]._config['password'] != passwd) \ |
|
|
else: |
|
|
or (port in ServerPool.get_instance().tcp_ipv6_servers_pool and ServerPool.get_instance().tcp_ipv6_servers_pool[port]._config['password'] != passwd): |
|
|
cfgchange = False |
|
|
#password changed |
|
|
if (port in ServerPool.get_instance().tcp_servers_pool): |
|
|
logging.info('db stop server at port [%s] reason: password changed' % (port,)) |
|
|
relay = ServerPool.get_instance().tcp_servers_pool[port] |
|
|
ServerPool.get_instance().cb_del_server(port) |
|
|
for name in ['password', 'method', 'obfs', 'protocol']: |
|
|
new_servers[port] = (passwd, cfg) |
|
|
if name in cfg and cfg[name] != relay._config[name]: |
|
|
|
|
|
cfgchange = True |
|
|
|
|
|
break; |
|
|
|
|
|
if (port in ServerPool.get_instance().tcp_ipv6_servers_pool): |
|
|
|
|
|
relay = ServerPool.get_instance().tcp_ipv6_servers_pool[port] |
|
|
|
|
|
for name in ['password', 'method', 'obfs', 'protocol']: |
|
|
|
|
|
if name in cfg and cfg[name] != relay._config[name]: |
|
|
|
|
|
cfgchange = True |
|
|
|
|
|
break; |
|
|
|
|
|
#config changed |
|
|
|
|
|
if cfgchange: |
|
|
|
|
|
logging.info('db stop server at port [%s] reason: config changed: %s' % (port, cfg)) |
|
|
|
|
|
ServerPool.get_instance().cb_del_server(port) |
|
|
|
|
|
new_servers[port] = (passwd, cfg) |
|
|
|
|
|
|
|
|
elif allow and ServerPool.get_instance().server_run_status(port) is False: |
|
|
elif allow and ServerPool.get_instance().server_run_status(port) is False: |
|
|
#new_servers[port] = passwd |
|
|
#new_servers[port] = passwd |
|
|