Server Status Changes

- refactored the code to stop the server status cycling and to be more accurate.
This commit is contained in:
Brett Hewitson 2022-07-15 22:36:13 +10:00
parent c79ec023d8
commit 9e52ccbaa1
15 changed files with 321 additions and 236 deletions

View file

@ -333,7 +333,7 @@
<value>5000</value> <value>5000</value>
</setting> </setting>
<setting name="ServerStatusWatcher_RemoteStatusQueryDelay" serializeAs="String"> <setting name="ServerStatusWatcher_RemoteStatusQueryDelay" serializeAs="String">
<value>120000</value> <value>60000</value>
</setting> </setting>
<setting name="ServerEngineConfigFile" serializeAs="String"> <setting name="ServerEngineConfigFile" serializeAs="String">
<value>Engine.ini</value> <value>Engine.ini</value>

View file

@ -2404,7 +2404,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("120000")] [global::System.Configuration.DefaultSettingValueAttribute("60000")]
public int ServerStatusWatcher_RemoteStatusQueryDelay { public int ServerStatusWatcher_RemoteStatusQueryDelay {
get { get {
return ((int)(this["ServerStatusWatcher_RemoteStatusQueryDelay"])); return ((int)(this["ServerStatusWatcher_RemoteStatusQueryDelay"]));

View file

@ -672,7 +672,7 @@
<Value Profile="(Default)">5000</Value> <Value Profile="(Default)">5000</Value>
</Setting> </Setting>
<Setting Name="ServerStatusWatcher_RemoteStatusQueryDelay" Type="System.Int32" Scope="Application"> <Setting Name="ServerStatusWatcher_RemoteStatusQueryDelay" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">120000</Value> <Value Profile="(Default)">60000</Value>
</Setting> </Setting>
<Setting Name="MainWindow_MinimizeToTray" Type="System.Boolean" Scope="User"> <Setting Name="MainWindow_MinimizeToTray" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>

View file

@ -252,84 +252,162 @@ namespace ServerManagerTool.Lib
{ {
case WatcherServerStatus.Unknown: case WatcherServerStatus.Unknown:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Unknown, AvailabilityStatus.Unknown, false); {
UpdateServerStatus(
ServerStatus.Unknown,
AvailabilityStatus.Unknown,
false);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.NotInstalled: case WatcherServerStatus.NotInstalled:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Uninstalled, AvailabilityStatus.Unavailable, false); {
UpdateServerStatus(
ServerStatus.Uninstalled,
AvailabilityStatus.Unavailable,
false);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.Stopped: case WatcherServerStatus.Stopped:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Stopped, AvailabilityStatus.Unavailable, oldStatus == ServerStatus.Initializing || oldStatus == ServerStatus.Running || oldStatus == ServerStatus.Stopping); {
UpdateServerStatus(
ServerStatus.Stopped,
AvailabilityStatus.Unavailable,
oldStatus == ServerStatus.Initializing || oldStatus == ServerStatus.Running || oldStatus == ServerStatus.Stopping);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.Initializing: case WatcherServerStatus.Initializing:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
UpdateServerStatus(ServerStatus.Initializing, AvailabilityStatus.Unavailable, oldStatus != ServerStatus.Initializing && oldStatus != ServerStatus.Unknown); {
UpdateServerStatus(
ServerStatus.Initializing,
AvailabilityStatus.Unavailable,
oldStatus != ServerStatus.Initializing && oldStatus != ServerStatus.Unknown);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.RunningLocalCheck: case WatcherServerStatus.LocalSuccess:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, oldAvailability != AvailabilityStatus.Available ? AvailabilityStatus.LocalOnly : AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.LocalOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
} }
break; break;
case WatcherServerStatus.RunningExternalCheck: case WatcherServerStatus.ExternalSkipped:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.PublicOnly, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
oldAvailability >= AvailabilityStatus.PublicOnly ? AvailabilityStatus.PublicOnly : AvailabilityStatus.LocalOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
}
break;
case WatcherServerStatus.ExternalSuccess:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.PublicOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
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; break;
case WatcherServerStatus.Published: case WatcherServerStatus.Published:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.Available,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
} }
break; break;
default: default:
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
} }

View file

@ -150,52 +150,52 @@ namespace ServerManagerTool.Lib
var currentStatus = WatcherServerStatus.Initializing; var currentStatus = WatcherServerStatus.Initializing;
// Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server local (directly) status at {registration.LocalEndpoint}");
// If the process was running do we then perform network checks.
//
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server local network status at {registration.LocalEndpoint}");
// get the server information direct from the server using local connection. // get the server information direct from the server using local endpoint.
var serverStatus = GetLocalNetworkStatus(registration.LocalEndpoint, out ServerInfo localInfo, out int onlinePlayerCount); var serverStatus = GetLocalNetworkStatus(registration.LocalEndpoint, out ServerInfo localInfo, out int onlinePlayerCount);
if (serverStatus) if (serverStatus)
{ {
currentStatus = WatcherServerStatus.RunningLocalCheck; currentStatus = WatcherServerStatus.LocalSuccess;
//
// Now that it's running, we can check the publication status.
//
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (directly) status at {registration.PublicEndpoint}"); Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (directly) status at {registration.PublicEndpoint}");
// get the server information direct from the server using public connection. // get the server information direct from the server using public endpoint.
serverStatus = GetPublicNetworkStatusDirectly(registration.PublicEndpoint); serverStatus = GetPublicNetworkStatusDirectly(registration.PublicEndpoint);
// check if the server returned the information. if (serverStatus)
if (!serverStatus) {
_nextExternalStatusQuery[registrationKey] = DateTime.MinValue;
currentStatus = WatcherServerStatus.Published;
}
else if (!string.IsNullOrWhiteSpace(Config.Default.ServerStatusUrlFormat))
{ {
// server did not return any information
var nextExternalStatusQuery = _nextExternalStatusQuery.ContainsKey(registrationKey) ? _nextExternalStatusQuery[registrationKey] : DateTime.MinValue; var nextExternalStatusQuery = _nextExternalStatusQuery.ContainsKey(registrationKey) ? _nextExternalStatusQuery[registrationKey] : DateTime.MinValue;
if (DateTime.Now >= nextExternalStatusQuery) if (DateTime.Now >= nextExternalStatusQuery)
{ {
currentStatus = WatcherServerStatus.RunningExternalCheck; Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (externally) status at {registration.PublicEndpoint}");
if (!string.IsNullOrWhiteSpace(Config.Default.ServerStatusUrlFormat)) // get the server information direct from the server using external endpoint.
var url = string.Format(Config.Default.ServerStatusUrlFormat, Config.Default.ServerManagerCode, App.Instance.Version, registration.PublicEndpoint.Address, registration.PublicEndpoint.Port);
var uri = new Uri(url);
serverStatus = await GetPublicNetworkStatusViaAPIAsync(uri, registration.PublicEndpoint);
var remoteStatusQueryDelay = serverStatus
? Config.Default.ServerStatusWatcher_RemoteStatusQueryDelay
: 15000;
_nextExternalStatusQuery[registrationKey] = DateTime.Now.AddMilliseconds(remoteStatusQueryDelay);
if (serverStatus)
{ {
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (via api) status at {registration.PublicEndpoint}"); currentStatus = WatcherServerStatus.ExternalSuccess;
// get the server information direct from the server using external connection.
var uri = new Uri(string.Format(Config.Default.ServerStatusUrlFormat, Config.Default.ServerManagerCode, App.Instance.Version, registration.PublicEndpoint.Address, registration.PublicEndpoint.Port));
serverStatus = await GetPublicNetworkStatusViaAPIAsync(uri, registration.PublicEndpoint);
} }
_nextExternalStatusQuery[registrationKey] = DateTime.Now.AddMilliseconds(Config.Default.ServerStatusWatcher_RemoteStatusQueryDelay);
} }
} else
{
// check if the server returned the information. currentStatus = WatcherServerStatus.ExternalSkipped;
if (serverStatus) }
{
currentStatus = WatcherServerStatus.Published;
} }
} }

View file

@ -5,7 +5,30 @@
<title>Ark Server Manager Version Feed</title> <title>Ark Server Manager Version Feed</title>
<subtitle>This is the Ark Server Manager release version feed.</subtitle> <subtitle>This is the Ark Server Manager release version feed.</subtitle>
<link href="https://arkservermanager.freeforums.net/" /> <link href="https://arkservermanager.freeforums.net/" />
<updated>2022-07-11T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
<title>1.1.436 (1.1.436.1)</title>
<summary>1.1.436.1</summary>
<link href="" />
<updated>2022-07-15T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Server Status - changed the server status code to stop the status cycling and to be more accurate.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry> <entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id> <id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id>

View file

@ -5,120 +5,21 @@
<title>Ark Server Manager Version Feed</title> <title>Ark Server Manager Version Feed</title>
<subtitle>This is the Ark Server Manager beta version feed.</subtitle> <subtitle>This is the Ark Server Manager beta version feed.</subtitle>
<link href="https://arkservermanager.freeforums.net/" /> <link href="https://arkservermanager.freeforums.net/" />
<updated>2022-07-12T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<entry> <entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id> <id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
<title>1.1.435 (1.1.435.5)</title> <title>1.1.436 (1.1.436.1)</title>
<summary>1.1.435.4</summary> <summary>1.1.436.1</summary>
<link href="" /> <link href="" />
<updated>2022-07-12T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Updated all URL links to use https.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id>
<title>1.1.435 (1.1.435.4)</title>
<summary>1.1.435.4</summary>
<link href="" />
<updated>2022-07-11T00:00:00Z</updated>
<content type="xhtml"> <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;"> <div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p> <p>
<u style="font-size: .9em;">BUGFIX</u> <u style="font-size: .9em;">BUGFIX</u>
<br/> <br/>
<ul> <ul>
<li>RCON - changed the way the online players are handled when they contain a '.' character.</li> <li>Server Status - changed the server status code to stop the status cycling and to be more accurate.</li>
</ul>
<u style="font-size: .9em;">NEW</u>
<br/>
<ul>
<li>tr-TR Translation file added.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id>
<title>1.1.435 (1.1.435.3)</title>
<summary>1.1.435.3</summary>
<link href="" />
<updated>2022-07-08T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Server Settings - Rules Section - Enable Tribe Alliance - fixed the checkbox, so that it enables/disables per profile.</li>
<li>Server Settings - Environment Section - Custom Harvest Amount Multiplier - fixed the checkbox, so that it enables/disables when there are changes or unknown resources.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id>
<title>1.1.435 (1.1.435.2)</title>
<summary>1.1.435.2</summary>
<link href="" />
<updated>2022-07-08T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added config settings to allow multiple CPUs to be read when setting the CPU Affinity.</li>
<li>fr-FR Translation file updated.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:7E95E486-1977-42F0-9AD6-8DB89A81A877</id>
<title>1.1.435 (1.1.435.1)</title>
<summary>1.1.435.1</summary>
<link href="" />
<updated>2022-07-01T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>zh-CN Translation file updated.</li>
</ul> </ul>
</p> </p>
</div> </div>

View file

@ -258,7 +258,7 @@
<value>5000</value> <value>5000</value>
</setting> </setting>
<setting name="ServerStatusWatcher_RemoteStatusQueryDelay" serializeAs="String"> <setting name="ServerStatusWatcher_RemoteStatusQueryDelay" serializeAs="String">
<value>120000</value> <value>60000</value>
</setting> </setting>
<setting name="DefaultDataDirectoryName" serializeAs="String"> <setting name="DefaultDataDirectoryName" serializeAs="String">
<value>csmdata</value> <value>csmdata</value>

View file

@ -1842,7 +1842,7 @@ namespace ServerManagerTool {
[global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("120000")] [global::System.Configuration.DefaultSettingValueAttribute("60000")]
public int ServerStatusWatcher_RemoteStatusQueryDelay { public int ServerStatusWatcher_RemoteStatusQueryDelay {
get { get {
return ((int)(this["ServerStatusWatcher_RemoteStatusQueryDelay"])); return ((int)(this["ServerStatusWatcher_RemoteStatusQueryDelay"]));

View file

@ -513,7 +513,7 @@
<Value Profile="(Default)">5000</Value> <Value Profile="(Default)">5000</Value>
</Setting> </Setting>
<Setting Name="ServerStatusWatcher_RemoteStatusQueryDelay" Type="System.Int32" Scope="Application"> <Setting Name="ServerStatusWatcher_RemoteStatusQueryDelay" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">120000</Value> <Value Profile="(Default)">60000</Value>
</Setting> </Setting>
<Setting Name="MainWindow_MinimizeToTray" Type="System.Boolean" Scope="User"> <Setting Name="MainWindow_MinimizeToTray" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>

View file

@ -251,84 +251,162 @@ namespace ServerManagerTool.Lib
{ {
case WatcherServerStatus.Unknown: case WatcherServerStatus.Unknown:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Unknown, AvailabilityStatus.Unknown, false); {
UpdateServerStatus(
ServerStatus.Unknown,
AvailabilityStatus.Unknown,
false);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.NotInstalled: case WatcherServerStatus.NotInstalled:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Uninstalled, AvailabilityStatus.Unavailable, false); {
UpdateServerStatus(
ServerStatus.Uninstalled,
AvailabilityStatus.Unavailable,
false);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.Stopped: case WatcherServerStatus.Stopped:
if (oldStatus != ServerStatus.Updating) if (oldStatus != ServerStatus.Updating)
UpdateServerStatus(ServerStatus.Stopped, AvailabilityStatus.Unavailable, oldStatus == ServerStatus.Initializing || oldStatus == ServerStatus.Running || oldStatus == ServerStatus.Stopping); {
UpdateServerStatus(
ServerStatus.Stopped,
AvailabilityStatus.Unavailable,
oldStatus == ServerStatus.Initializing || oldStatus == ServerStatus.Running || oldStatus == ServerStatus.Stopping);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.Initializing: case WatcherServerStatus.Initializing:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
UpdateServerStatus(ServerStatus.Initializing, AvailabilityStatus.Unavailable, oldStatus != ServerStatus.Initializing && oldStatus != ServerStatus.Unknown); {
UpdateServerStatus(
ServerStatus.Initializing,
AvailabilityStatus.Unavailable,
oldStatus != ServerStatus.Initializing && oldStatus != ServerStatus.Unknown);
}
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
case WatcherServerStatus.RunningLocalCheck: case WatcherServerStatus.LocalSuccess:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, oldAvailability != AvailabilityStatus.Available ? AvailabilityStatus.LocalOnly : AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.LocalOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
} }
break; break;
case WatcherServerStatus.RunningExternalCheck: case WatcherServerStatus.ExternalSkipped:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.PublicOnly, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
oldAvailability >= AvailabilityStatus.PublicOnly ? AvailabilityStatus.PublicOnly : AvailabilityStatus.LocalOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
}
break;
case WatcherServerStatus.ExternalSuccess:
if (oldStatus != ServerStatus.Stopping)
{
UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.PublicOnly,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
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; break;
case WatcherServerStatus.Published: case WatcherServerStatus.Published:
if (oldStatus != ServerStatus.Stopping) if (oldStatus != ServerStatus.Stopping)
{ {
UpdateServerStatus(ServerStatus.Running, AvailabilityStatus.Available, oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown); UpdateServerStatus(
ServerStatus.Running,
AvailabilityStatus.Available,
oldStatus != ServerStatus.Running && oldStatus != ServerStatus.Unknown);
if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled) if (this.ProfileSnapshot.MOTDIntervalEnabled && this.motdIntervalTimer != null && !this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Start(); this.motdIntervalTimer.Start();
}
} }
else else
{ {
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
} }
break; break;
default: default:
if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled) if (this.motdIntervalTimer != null && this.motdIntervalTimer.Enabled)
{
this.motdIntervalTimer.Stop(); this.motdIntervalTimer.Stop();
}
break; break;
} }

View file

@ -150,52 +150,52 @@ namespace ServerManagerTool.Lib
var currentStatus = WatcherServerStatus.Initializing; var currentStatus = WatcherServerStatus.Initializing;
// Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server local (directly) status at {registration.LocalEndpoint}");
// If the process was running do we then perform network checks.
//
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server local network status at {registration.LocalEndpoint}");
// get the server information direct from the server using local connection. // get the server information direct from the server using local endpoint.
var serverStatus = GetLocalNetworkStatus(registration.LocalEndpoint, out ServerInfo localInfo, out int onlinePlayerCount); var serverStatus = GetLocalNetworkStatus(registration.LocalEndpoint, out ServerInfo localInfo, out int onlinePlayerCount);
if (serverStatus) if (serverStatus)
{ {
currentStatus = WatcherServerStatus.RunningLocalCheck; currentStatus = WatcherServerStatus.LocalSuccess;
//
// Now that it's running, we can check the publication status.
//
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (directly) status at {registration.PublicEndpoint}"); Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (directly) status at {registration.PublicEndpoint}");
// get the server information direct from the server using public connection. // get the server information direct from the server using public endpoint.
serverStatus = GetPublicNetworkStatusDirectly(registration.PublicEndpoint); serverStatus = GetPublicNetworkStatusDirectly(registration.PublicEndpoint);
// check if the server returned the information. if (serverStatus)
if (!serverStatus) {
_nextExternalStatusQuery[registrationKey] = DateTime.MinValue;
currentStatus = WatcherServerStatus.Published;
}
else if (!string.IsNullOrWhiteSpace(Config.Default.ServerStatusUrlFormat))
{ {
// server did not return any information
var nextExternalStatusQuery = _nextExternalStatusQuery.ContainsKey(registrationKey) ? _nextExternalStatusQuery[registrationKey] : DateTime.MinValue; var nextExternalStatusQuery = _nextExternalStatusQuery.ContainsKey(registrationKey) ? _nextExternalStatusQuery[registrationKey] : DateTime.MinValue;
if (DateTime.Now >= nextExternalStatusQuery) if (DateTime.Now >= nextExternalStatusQuery)
{ {
currentStatus = WatcherServerStatus.RunningExternalCheck; Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (externally) status at {registration.PublicEndpoint}");
if (!string.IsNullOrWhiteSpace(Config.Default.ServerStatusUrlFormat)) // get the server information direct from the server using external endpoint.
var url = string.Format(Config.Default.ServerStatusUrlFormat, Config.Default.ServerManagerCode, App.Instance.Version, registration.PublicEndpoint.Address, registration.PublicEndpoint.Port);
var uri = new Uri(url);
serverStatus = await GetPublicNetworkStatusViaAPIAsync(uri, registration.PublicEndpoint);
var remoteStatusQueryDelay = serverStatus
? Config.Default.ServerStatusWatcher_RemoteStatusQueryDelay
: 15000;
_nextExternalStatusQuery[registrationKey] = DateTime.Now.AddMilliseconds(remoteStatusQueryDelay);
if (serverStatus)
{ {
Logger.Info($"{nameof(DoServerStatusUpdateAsync)} Checking server public (via api) status at {registration.PublicEndpoint}"); currentStatus = WatcherServerStatus.ExternalSuccess;
// get the server information direct from the server using external connection.
var uri = new Uri(string.Format(Config.Default.ServerStatusUrlFormat, Config.Default.ServerManagerCode, App.Instance.Version, registration.PublicEndpoint.Address, registration.PublicEndpoint.Port));
serverStatus = await GetPublicNetworkStatusViaAPIAsync(uri, registration.PublicEndpoint);
} }
_nextExternalStatusQuery[registrationKey] = DateTime.Now.AddMilliseconds(Config.Default.ServerStatusWatcher_RemoteStatusQueryDelay);
} }
} else
{
// check if the server returned the information. currentStatus = WatcherServerStatus.ExternalSkipped;
if (serverStatus) }
{
currentStatus = WatcherServerStatus.Published;
} }
} }

View file

@ -5,7 +5,30 @@
<title>Conan Server Manager Version Feed</title> <title>Conan Server Manager Version Feed</title>
<subtitle>This is the Conan Server Manager release version feed.</subtitle> <subtitle>This is the Conan Server Manager release version feed.</subtitle>
<link href="https://servermanagers.freeforums.net/" /> <link href="https://servermanagers.freeforums.net/" />
<updated>2022-07-08T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<entry>
<id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
<title>1.1.79 (1.1.79.1)</title>
<summary>1.1.79.1</summary>
<link href="" />
<updated>2022-07-15T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">BUGFIX</u>
<br/>
<ul>
<li>Server Status - changed the server status code to stop the status cycling and to be more accurate.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry> <entry>
<id>urn:uuid:CDD1853D-66EA-4649-AD24-E491D64C853E</id> <id>urn:uuid:CDD1853D-66EA-4649-AD24-E491D64C853E</id>

View file

@ -5,44 +5,21 @@
<title>Conan Server Manager Version Feed</title> <title>Conan Server Manager Version Feed</title>
<subtitle>This is the Conan Server Manager beta version feed.</subtitle> <subtitle>This is the Conan Server Manager beta version feed.</subtitle>
<link href="https://servermanagers.freeforums.net/" /> <link href="https://servermanagers.freeforums.net/" />
<updated>2022-07-12T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<entry> <entry>
<id>urn:uuid:CDD1853D-66EA-4649-AD24-E491D64C853E</id> <id>urn:uuid:8CDA70CF-E8B8-4B9B-AD50-AD9A8B528E5B</id>
<title>1.1.78 (1.1.78.2)</title> <title>1.1.79 (1.1.79.1)</title>
<summary>1.1.78.1</summary> <summary>1.1.79.1</summary>
<link href="" /> <link href="" />
<updated>2022-07-12T00:00:00Z</updated> <updated>2022-07-15T00:00:00Z</updated>
<content type="xhtml"> <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;"> <div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p> <p>
<u style="font-size: .9em;">CHANGE</u> <u style="font-size: .9em;">BUGFIX</u>
<br/> <br/>
<ul> <ul>
<li>Updated all URL links to use https.</li> <li>Server Status - changed the server status code to stop the status cycling and to be more accurate.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:CDD1853D-66EA-4649-AD24-E491D64C853E</id>
<title>1.1.78 (1.1.78.1)</title>
<summary>1.1.78.1</summary>
<link href="" />
<updated>2022-07-08T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added config settings to allow multiple CPUs to be read when setting the CPU Affinity.</li>
</ul> </ul>
</p> </p>
</div> </div>

View file

@ -25,15 +25,20 @@
/// <summary> /// <summary>
/// The server is responding locally on its port, a local check was made /// The server is responding locally on its port, a local check was made
/// </summary> /// </summary>
RunningLocalCheck, LocalSuccess,
/// <summary>
/// The server is responding locally on its port, a public check was skipped
/// </summary>
ExternalSkipped,
/// <summary> /// <summary>
/// The server is responding locally on its port, a public check was made /// The server is responding locally on its port, a public check was made
/// </summary> /// </summary>
RunningExternalCheck, ExternalSuccess,
/// <summary> /// <summary>
/// The server is responding externally on its port /// The server is responding publicly on its port
/// </summary> /// </summary>
Published, Published,
} }