diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index abbb966..da0565c 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -1108,7 +1108,8 @@ class TCPRelay(object): else: if user not in self.server_user_transfer_ul: self.server_user_transfer_ul[user] = 0 - self.server_user_transfer_ul[user] += transfer + self.server_user_transfer_ul[user] += transfer + self.server_transfer_ul + self.server_transfer_ul = 0 def add_transfer_d(self, user, transfer): if user is None: @@ -1116,7 +1117,8 @@ class TCPRelay(object): else: if user not in self.server_user_transfer_dl: self.server_user_transfer_dl[user] = 0 - self.server_user_transfer_dl[user] += transfer + self.server_user_transfer_dl[user] += transfer + self.server_transfer_dl + self.server_transfer_dl = 0 def update_stat(self, port, stat_dict, val): newval = stat_dict.get(0, 0) + val diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index 994fdee..9ee5ccf 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -1008,7 +1008,8 @@ class UDPRelay(object): else: if user not in self.server_user_transfer_ul: self.server_user_transfer_ul[user] = 0 - self.server_user_transfer_ul[user] += transfer + self.server_user_transfer_ul[user] += transfer + self.server_transfer_ul + self.server_transfer_ul = 0 def add_transfer_d(self, user, transfer): if user is None: @@ -1016,7 +1017,8 @@ class UDPRelay(object): else: if user not in self.server_user_transfer_dl: self.server_user_transfer_dl[user] = 0 - self.server_user_transfer_dl[user] += transfer + self.server_user_transfer_dl[user] += transfer + self.server_transfer_dl + self.server_transfer_dl = 0 def _close_client_pair(self, client_pair): client, uid = client_pair