From 16b74ece806acb9aea135078d9e6c9aabbea86dc Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Wed, 17 Jul 2024 09:44:20 +0000 Subject: [PATCH] FIX: Don't panic when a client disconnects without a name --- server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.py b/server.py index b3480ea..da07726 100755 --- a/server.py +++ b/server.py @@ -120,6 +120,7 @@ def fmt(msg: str, name: str = "", action: bool = False) -> str: async def handleClient(reader, writer): try: + name = "" global G writer.write(b"Please identify yourself. Nick limit is 20 chars.\n") await writer.drain() @@ -384,6 +385,8 @@ Please note that this is not network level statistics.\n""".encode( del G.servers[sName] G.msgs.append(log(f"{sName} has de-linked from the network")) except DisconnectErrors: + if not name: + return if not name.startswith("S2S-"): G.uniqueClients -= 1 G.msgs.append(log(f"{name} has disconnected from the server."))