Merge main into v25

This commit is contained in:
Scott Anderson
2025-07-27 15:25:29 -04:00
28 changed files with 1576 additions and 232 deletions
+1 -7
View File
@@ -177,7 +177,6 @@ export class GameServer {
client.isDisconnected = existing.isDisconnected;
client.lastPing = existing.lastPing;
existing.ws.removeAllListeners();
this.activeClients = this.activeClients.filter((c) => c !== existing);
}
@@ -187,7 +186,7 @@ export class GameServer {
this.allClients.set(client.clientID, client);
client.ws.removeAllListeners();
client.ws.removeAllListeners("message");
client.ws.on(
"message",
gatekeeper.wsHandler(client.ip, async (message: string) => {
@@ -206,7 +205,6 @@ export class GameServer {
} satisfies ServerErrorMessage),
);
client.ws.close(1002, "ClientMessageSchema");
client.ws.removeAllListeners();
return;
}
const clientMsg = parsed.data;
@@ -264,7 +262,6 @@ export class GameServer {
});
client.ws.on("error", (error: Error) => {
if ((error as any).code === "WS_ERR_UNEXPECTED_RSV_1") {
client.ws.removeAllListeners();
client.ws.close(1002, "WS_ERR_UNEXPECTED_RSV_1");
}
});
@@ -408,7 +405,6 @@ export class GameServer {
clearInterval(this.endTurnIntervalID);
}
this.websockets.forEach((ws) => {
ws.removeAllListeners();
if (ws.readyState === WebSocket.OPEN) {
ws.close(1000, "game has ended");
}
@@ -466,7 +462,6 @@ export class GameServer {
});
if (client.ws.readyState === WebSocket.OPEN) {
client.ws.close(1000, "no heartbeats received, closing connection");
client.ws.removeAllListeners();
}
} else {
alive.push(client);
@@ -561,7 +556,6 @@ export class GameServer {
this.activeClients = this.activeClients.filter(
(c) => c.clientID !== clientID,
);
client.ws.removeAllListeners();
this.kickedClients.add(clientID);
} else {
this.log.warn(`cannot kick client, not found in game`, {