fix mudbjson mode
This commit is contained in:
parent
783267dba0
commit
6255a1d321
1 changed files with 6 additions and 3 deletions
|
@ -128,6 +128,7 @@ class DbTransfer(object):
|
||||||
port = row['port']
|
port = row['port']
|
||||||
passwd = common.to_bytes(row['passwd'])
|
passwd = common.to_bytes(row['passwd'])
|
||||||
cfg = {'password': passwd}
|
cfg = {'password': passwd}
|
||||||
|
if 'id' in row:
|
||||||
self.port_uid_table[row['port']] = row['id']
|
self.port_uid_table[row['port']] = row['id']
|
||||||
|
|
||||||
read_config_keys = ['method', 'obfs', 'obfs_param', 'protocol', 'protocol_param', 'forbidden_ip', 'forbidden_port']
|
read_config_keys = ['method', 'obfs', 'obfs_param', 'protocol', 'protocol_param', 'forbidden_ip', 'forbidden_port']
|
||||||
|
@ -181,6 +182,7 @@ class DbTransfer(object):
|
||||||
else:
|
else:
|
||||||
logging.info('db stop server at port [%s] reason: port not exist' % (row['port']))
|
logging.info('db stop server at port [%s] reason: port not exist' % (row['port']))
|
||||||
ServerPool.get_instance().cb_del_server(row['port'])
|
ServerPool.get_instance().cb_del_server(row['port'])
|
||||||
|
if row['port'] in self.port_uid_table:
|
||||||
del self.port_uid_table[row['port']]
|
del self.port_uid_table[row['port']]
|
||||||
|
|
||||||
if len(new_servers) > 0:
|
if len(new_servers) > 0:
|
||||||
|
@ -260,6 +262,7 @@ class Dbv3Transfer(DbTransfer):
|
||||||
query_sub_when2 += ' WHEN %s THEN d+%s' % (id, transfer[1])
|
query_sub_when2 += ' WHEN %s THEN d+%s' % (id, transfer[1])
|
||||||
|
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
if id in self.port_uid_table:
|
||||||
cur.execute("INSERT INTO `user_traffic_log` (`id`, `user_id`, `u`, `d`, `Node_ID`, `rate`, `traffic`, `log_time`) VALUES (NULL, '" + \
|
cur.execute("INSERT INTO `user_traffic_log` (`id`, `user_id`, `u`, `d`, `Node_ID`, `rate`, `traffic`, `log_time`) VALUES (NULL, '" + \
|
||||||
str(self.port_uid_table[id]) + "', '" + str(transfer[0]) + "', '" + str(transfer[1]) + "', '" + \
|
str(self.port_uid_table[id]) + "', '" + str(transfer[0]) + "', '" + str(transfer[1]) + "', '" + \
|
||||||
str(get_config().NODE_ID) + "', '" + str(get_config().TRANSFER_MUL) + "', '" + \
|
str(get_config().NODE_ID) + "', '" + str(get_config().TRANSFER_MUL) + "', '" + \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue