Don't crash on invalid messages & increase char limit for S2S communications

This commit is contained in:
Firepup Sixfifty 2024-07-31 20:21:04 +00:00
parent a6ecd9a129
commit a6a9ba0754
Signed by: Firepup650
SSH key fingerprint: SHA256:U0Zp8EhEe3CMqFSrC79CqatzaEiL4sjta80/RSX2XrY

View file

@ -471,7 +471,7 @@ async def connectServer(hostname: str, port: int):
try:
while 1:
try:
rawMsg = await asyncio.wait_for(reader.read(967), 0.1)
rawMsg = await asyncio.wait_for(reader.read(1024), 0.1)
buffer = raw(rawMsg.decode("utf8"))
match buffer[0]:
case "S":
@ -538,7 +538,7 @@ async def connectServer(hostname: str, port: int):
)
)
log(
f"Recieved invalid message ({buffer}) from {sName}",
f"Recieved invalid message ({buffer}) from {rID}",
"WARN",
)
await writer.drain()