fix connections stat
mgr help info
This commit is contained in:
parent
3d56b040cf
commit
3d1d38aa0f
2 changed files with 3 additions and 5 deletions
|
@ -147,6 +147,7 @@ Options:
|
||||||
-O PROTOCOL protocol plugin, default: auth_sha1_v2_compatible
|
-O PROTOCOL protocol plugin, default: auth_sha1_v2_compatible
|
||||||
-o OBFS obfs plugin, default: tls1.2_ticket_auth_compatible
|
-o OBFS obfs plugin, default: tls1.2_ticket_auth_compatible
|
||||||
-t TRANSFER max transfer for G bytes, default: 1048576, can be float point number
|
-t TRANSFER max transfer for G bytes, default: 1048576, can be float point number
|
||||||
|
-f FORBID set forbidden ports. Example (ban 1~79 and 81~100): -f "1-79,81-100"
|
||||||
|
|
||||||
General options:
|
General options:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
|
|
|
@ -994,14 +994,11 @@ class TCPRelay(object):
|
||||||
self._stat_counter[self._listen_port] = {}
|
self._stat_counter[self._listen_port] = {}
|
||||||
newval = self._stat_counter[self._listen_port].get(local_addr, 0) + val
|
newval = self._stat_counter[self._listen_port].get(local_addr, 0) + val
|
||||||
logging.debug('port %d addr %s connections %d' % (self._listen_port, local_addr, newval))
|
logging.debug('port %d addr %s connections %d' % (self._listen_port, local_addr, newval))
|
||||||
|
self._stat_counter[self._listen_port][local_addr] = newval
|
||||||
|
self.update_stat(self._listen_port, self._stat_counter[self._listen_port], val)
|
||||||
if newval <= 0:
|
if newval <= 0:
|
||||||
if local_addr in self._stat_counter[self._listen_port]:
|
if local_addr in self._stat_counter[self._listen_port]:
|
||||||
del self._stat_counter[self._listen_port][local_addr]
|
del self._stat_counter[self._listen_port][local_addr]
|
||||||
if len(self._stat_counter[self._listen_port]) == 0:
|
|
||||||
del self._stat_counter[self._listen_port]
|
|
||||||
else:
|
|
||||||
self._stat_counter[self._listen_port][local_addr] = newval
|
|
||||||
self.update_stat(self._listen_port, self._stat_counter[self._listen_port], val)
|
|
||||||
|
|
||||||
newval = self._stat_counter.get(0, 0) + val
|
newval = self._stat_counter.get(0, 0) + val
|
||||||
self._stat_counter[0] = newval
|
self._stat_counter[0] = newval
|
||||||
|
|
Loading…
Add table
Reference in a new issue