Console Log Updates, Specify min supported ZeroNet version for Rust version Protocol Compatibility

Reduce noise(error => warning) on file missing in sites.
This commit is contained in:
canewsin 2022-06-09 22:38:57 +05:30
parent 712ee18634
commit 016cfe9e16
3 changed files with 11 additions and 6 deletions

@ -1 +1 @@
Subproject commit 1a520d1fe95a7aef5307e9e7befd5fbcbfd08809
Subproject commit 859ffbf43335796e225525ff01257711485088d9

View File

@ -32,6 +32,7 @@ class ConnectionServer(object):
self.port = port
self.last_connection_id = 0 # Connection id incrementer
self.last_connection_id_current_version = 0 # Connection id incrementer for current client version
self.last_connection_id_supported_version = 0 # Connection id incrementer for last supported version
self.log = logging.getLogger("ConnServer")
self.port_opened = {}
self.peer_blacklist = SiteManager.peer_blacklist
@ -157,8 +158,10 @@ 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 rev >= 4560:
self.last_connection_id_supported_version += 1
if rev == config.rev:
self.last_connection_id_current_version += 1
if ip not in config.ip_local:
self.ips[ip] = connection
connection.handleIncomingConnection(sock)
@ -225,8 +228,10 @@ class ConnectionServer(object):
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
if rev >= 4560:
self.last_connection_id_supported_version += 1
if rev == config.rev:
self.last_connection_id_current_version += 1
except Exception as err:
connection.close("%s Connect error: %s" % (ip, Debug.formatException(err)))

View File

@ -373,7 +373,7 @@ class SiteStorage(object):
with self.open(inner_path, "r", encoding="utf8") as file:
return json.load(file)
except Exception as err:
self.log.error("Json load error: %s" % Debug.formatException(err))
self.log.warning("Json load error: %s" % Debug.formatException(err))
return None
# Write formatted json file