v 0.7.6-internal

- Added `access_key` variable in Config, this used to access restrited plugins when multiuser plugin is enabled. When MultiUserPlugin is enabled we cannot access some pages like /Stats, this key will remove such restriction with access key.
- Added `last_connection_id_current_version` to ConnectionServer, helpful to estimate no of connection from current client version.
- Added current version:  connections to /Stats page. see the previous point.
This commit is contained in:
canewsin 2021-12-11 16:35:02 +05:30
parent 0bbf19aab9
commit 0e48004563
3 changed files with 25 additions and 10 deletions

View file

@ -30,7 +30,8 @@ class ConnectionServer(object):
port = 15441
self.ip = ip
self.port = port
self.last_connection_id = 1 # Connection id incrementer
self.last_connection_id = 0 # Connection id incrementer
self.last_connection_id_current_version = 0 # Connection id incrementer for current client version
self.log = logging.getLogger("ConnServer")
self.port_opened = {}
self.peer_blacklist = SiteManager.peer_blacklist
@ -155,6 +156,9 @@ class ConnectionServer(object):
connection = Connection(self, ip, port, sock)
self.connections.append(connection)
rev = connection.handshake.get("rev", 0)
if rev > 0 and rev == config.rev:
self.last_connection_id_current_version += 1
if ip not in config.ip_local:
self.ips[ip] = connection
connection.handleIncomingConnection(sock)
@ -219,6 +223,10 @@ class ConnectionServer(object):
if not succ:
connection.close("Connection event return error")
raise Exception("Connection event return error")
else:
rev = connection.handshake.get("rev", 0)
if rev > 0 and rev == config.rev:
self.last_connection_id_current_version += 1
except Exception as err:
connection.close("%s Connect error: %s" % (ip, Debug.formatException(err)))