Add a new dead process check by utilizing the game's listener port.
This commit is contained in:
parent
6574888344
commit
b098493b67
1 changed files with 15 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue