This commit is contained in:
Firepup Sixfifty 2024-07-31 21:30:11 +00:00
parent 6d1ff52b02
commit aaeb313181
Signed by: Firepup650
SSH key fingerprint: SHA256:U0Zp8EhEe3CMqFSrC79CqatzaEiL4sjta80/RSX2XrY

View file

@ -36,7 +36,7 @@ G.killList = {}
G.outboundLinks = [] G.outboundLinks = []
G.S2SLogs = [] G.S2SLogs = []
G.cwlgd = False G.cwlgd = False
G.NUL = "\x00" G.NUL = "|"
saveLogs = True saveLogs = True
address = "::" address = "::"
# Try to load a message log, if one exists # Try to load a message log, if one exists
@ -91,7 +91,7 @@ Examples:
if not G.remoteID or len(G.remoteID) > 16: if not G.remoteID or len(G.remoteID) > 16:
raise ValueError raise ValueError
elif arg.startswith("--address"): elif arg.startswith("--address"):
address = arg[9:] address = arg[10:]
elif arg.startswith("--cwlgd"): elif arg.startswith("--cwlgd"):
G.cwlgd = True G.cwlgd = True
log("Server will crash when outbound links go down!", "WARN") log("Server will crash when outbound links go down!", "WARN")
@ -608,6 +608,7 @@ async def runServer(address: str, port: int):
else: else:
INET = socket.AF_INET INET = socket.AF_INET
sock = socket.socket(INET, socket.SOCK_STREAM) sock = socket.socket(INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Reuse socket
sock.bind((address, port)) sock.bind((address, port))
server = await asyncio.start_server(handleClient, sock=sock) server = await asyncio.start_server(handleClient, sock=sock)
log(f"Listening on port {port}...") log(f"Listening on port {port}...")
@ -643,6 +644,7 @@ async def runServer(address: str, port: int):
log("Saved logs, exiting now.") log("Saved logs, exiting now.")
else: else:
log("Not saving logs, exiting now.") log("Not saving logs, exiting now.")
sock.close()
class ServerInterruptException(KeyboardInterrupt): ... class ServerInterruptException(KeyboardInterrupt): ...