mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 00:01:56 +00:00
Added a single idleTimeout
This commit is contained in:
@@ -35,8 +35,7 @@ export class GameServer {
|
||||
|
||||
private maxGameDuration = 3 * 60 * 60 * 1000; // 3 hours
|
||||
|
||||
private disconnectionTimeout = 1 * 60 * 1000; // 1 minute
|
||||
private inactivityTimeout = 3 * 60 * 1000; // 3 minute
|
||||
private idleTimeout = 1 * 60 * 1000; // 1 minute
|
||||
|
||||
private turns: Turn[] = [];
|
||||
private intents: Intent[] = [];
|
||||
@@ -552,14 +551,14 @@ export class GameServer {
|
||||
for (const [clientID, client] of this.allClients) {
|
||||
if (
|
||||
client.isIdle === false &&
|
||||
(now - client.lastPing > this.disconnectionTimeout ||
|
||||
now - client.lastAction > this.inactivityTimeout)
|
||||
now - client.lastPing > this.idleTimeout &&
|
||||
now - client.lastAction > this.idleTimeout
|
||||
) {
|
||||
this.markClientIdle(client, true);
|
||||
} else if (
|
||||
client.isIdle &&
|
||||
now - client.lastPing < this.disconnectionTimeout &&
|
||||
now - client.lastAction < this.inactivityTimeout
|
||||
now - client.lastPing < this.idleTimeout &&
|
||||
now - client.lastAction < this.idleTimeout
|
||||
) {
|
||||
this.markClientIdle(client, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user