mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-23 21:41:19 +00:00
Merge main into v25
This commit is contained in:
@@ -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`, {
|
||||
|
||||
Reference in New Issue
Block a user