mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-30 04:59:40 +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 maxGameDuration = 3 * 60 * 60 * 1000; // 3 hours
|
||||||
|
|
||||||
private disconnectionTimeout = 1 * 60 * 1000; // 1 minute
|
private idleTimeout = 1 * 60 * 1000; // 1 minute
|
||||||
private inactivityTimeout = 3 * 60 * 1000; // 3 minute
|
|
||||||
|
|
||||||
private turns: Turn[] = [];
|
private turns: Turn[] = [];
|
||||||
private intents: Intent[] = [];
|
private intents: Intent[] = [];
|
||||||
@@ -552,14 +551,14 @@ export class GameServer {
|
|||||||
for (const [clientID, client] of this.allClients) {
|
for (const [clientID, client] of this.allClients) {
|
||||||
if (
|
if (
|
||||||
client.isIdle === false &&
|
client.isIdle === false &&
|
||||||
(now - client.lastPing > this.disconnectionTimeout ||
|
now - client.lastPing > this.idleTimeout &&
|
||||||
now - client.lastAction > this.inactivityTimeout)
|
now - client.lastAction > this.idleTimeout
|
||||||
) {
|
) {
|
||||||
this.markClientIdle(client, true);
|
this.markClientIdle(client, true);
|
||||||
} else if (
|
} else if (
|
||||||
client.isIdle &&
|
client.isIdle &&
|
||||||
now - client.lastPing < this.disconnectionTimeout &&
|
now - client.lastPing < this.idleTimeout &&
|
||||||
now - client.lastAction < this.inactivityTimeout
|
now - client.lastAction < this.idleTimeout
|
||||||
) {
|
) {
|
||||||
this.markClientIdle(client, false);
|
this.markClientIdle(client, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user