FIX: Don't panic when a client disconnects without a name

This commit is contained in:
Firepup Sixfifty 2024-07-17 09:44:20 +00:00
parent 7c0c4b0875
commit 16b74ece80
Signed by: Firepup650
SSH key fingerprint: SHA256:U0Zp8EhEe3CMqFSrC79CqatzaEiL4sjta80/RSX2XrY

View file

@ -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."))