mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added better status detection for stopping servers
This commit is contained in:
parent
034a6228d7
commit
3c822fa982
14 changed files with 183 additions and 46 deletions
|
|
@ -257,6 +257,8 @@ namespace ServerManagerTool.Lib
|
|||
return;
|
||||
}
|
||||
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
|
||||
|
||||
// make a backup of the current profile and config files.
|
||||
CreateProfileBackupArchiveFile(_profile);
|
||||
|
||||
|
|
@ -404,6 +406,7 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
|
||||
_serverRunning = true;
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopping);
|
||||
LogProfileMessage($"Server process found PID {process.Id}.");
|
||||
|
||||
QueryMaster.Server gameServer = null;
|
||||
|
|
@ -1165,6 +1168,8 @@ namespace ServerManagerTool.Lib
|
|||
if (ExitCode != EXITCODE_NORMALEXIT)
|
||||
return;
|
||||
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Stopped);
|
||||
|
||||
emailMessage.AppendLine("Update Summary:");
|
||||
emailMessage.AppendLine();
|
||||
emailMessage.AppendLine($"Server Manager version: {App.Instance.Version}");
|
||||
|
|
@ -2435,7 +2440,7 @@ namespace ServerManagerTool.Lib
|
|||
_loggerBranch?.Info(message);
|
||||
|
||||
if (includeProgressCallback)
|
||||
ProgressCallback?.Invoke(0, $"[INFO] {message}");
|
||||
ProgressCallback?.Invoke(0, $"{message}");
|
||||
|
||||
Debug.WriteLine($"[INFO] (Branch {GetBranchName(branchName) ?? "unknown"}) {message}");
|
||||
}
|
||||
|
|
@ -2460,7 +2465,7 @@ namespace ServerManagerTool.Lib
|
|||
_loggerProfile?.Info(message);
|
||||
|
||||
if (includeProgressCallback)
|
||||
ProgressCallback?.Invoke(0, $"[INFO] {message}");
|
||||
ProgressCallback?.Invoke(0, $"{message}");
|
||||
|
||||
Debug.WriteLine($"[INFO] (Profile {_profile?.ProfileName ?? "unknown"}) {message}");
|
||||
}
|
||||
|
|
@ -2709,6 +2714,8 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
|
||||
|
||||
LogProfileMessage("");
|
||||
LogProfileMessage($"Exitcode = {ExitCode}");
|
||||
return ExitCode;
|
||||
|
|
@ -2806,6 +2813,8 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
|
||||
|
||||
LogProfileMessage("");
|
||||
LogProfileMessage($"Exitcode = {ExitCode}");
|
||||
return ExitCode;
|
||||
|
|
@ -2886,6 +2895,8 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
ServerStatusChangeCallback?.Invoke(ServerStatus.Unknown);
|
||||
|
||||
LogProfileMessage("");
|
||||
LogProfileMessage($"Exitcode = {ExitCode}");
|
||||
return ExitCode;
|
||||
|
|
|
|||
|
|
@ -274,20 +274,32 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
case WatcherServerStatus.RunningLocalCheck:
|
||||
if (oldStatus != ServerStatus.Stopping)
|
||||
{
|
||||
UpdateServerStatus(ServerStatus.Running, this.Availability != AvailabilityStatus.Available ? AvailabilityStatus.Waiting : this.Availability, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
}
|
||||
else
|
||||
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
|
||||
break;
|
||||
|
||||
case WatcherServerStatus.RunningExternalCheck:
|
||||
if (oldStatus != ServerStatus.Stopping)
|
||||
{
|
||||
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Waiting, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
}
|
||||
else
|
||||
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
|
||||
break;
|
||||
|
||||
case WatcherServerStatus.Published:
|
||||
if (oldStatus != ServerStatus.Stopping)
|
||||
{
|
||||
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Start();
|
||||
}
|
||||
else
|
||||
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) this.motdIntervalTimer.Stop();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -965,7 +977,23 @@ namespace ServerManagerTool.Lib
|
|||
|
||||
public void UpdateServerStatus(ServerStatus serverStatus, bool sendAlert)
|
||||
{
|
||||
UpdateServerStatus(serverStatus, Availability, sendAlert);
|
||||
var availability = Availability;
|
||||
|
||||
switch (serverStatus)
|
||||
{
|
||||
case ServerStatus.Stopped:
|
||||
case ServerStatus.Stopping:
|
||||
case ServerStatus.Uninstalled:
|
||||
case ServerStatus.Updating:
|
||||
availability = AvailabilityStatus.Unavailable;
|
||||
break;
|
||||
case ServerStatus.Unknown:
|
||||
availability = AvailabilityStatus.Unknown;
|
||||
sendAlert = false;
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateServerStatus(serverStatus, availability, sendAlert);
|
||||
}
|
||||
|
||||
public void UpdateServerStatus(ServerStatus serverStatus, AvailabilityStatus availabilityStatus, bool sendAlert)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue