Add a new dead process check by utilizing the game's listener port.

This commit is contained in:
zontreck 2024-06-05 20:34:23 -07:00
parent 6574888344
commit b098493b67

View file

@ -239,6 +239,7 @@ class StateMachine {
// Restart timers and such
SessionData.timer.tickDown();
SessionData.operating_time.tickUp();
SessionData.timeSinceLastPing.tickUp();
SessionData.bumpModUpdateChecker();
// Check if we should send an alert
@ -254,6 +255,20 @@ class StateMachine {
}
}
// Ping the server to check if it is alive
if (SessionData.timeSinceLastPing.getTotalSeconds() > 60 &&
SessionData.operating_time.getTotalSeconds() > (10 * 60)) {
SessionData.timeSinceLastPing.apply(0);
try {
Socket sock = await Socket.connect(
"127.0.0.1", settings.inst!.serverSettings.GamePort);
await sock.close();
} catch (E) {
DeadProcKillswitch.complete();
}
}
if (send && SessionData.enableRestartTimer) {
// Send the alert message
SessionData.CURRENT_INTERVAL = current;