diff --git a/build/Version.props b/build/Version.props
index 44647f7611..7214e884f4 100644
--- a/build/Version.props
+++ b/build/Version.props
@@ -7,7 +7,7 @@
2.2.0
8.2.0
9.1.1
- 5.2.10
+ 5.2.11
1.1.0
1.2.0
diff --git a/src/DMAPI/tgs.dm b/src/DMAPI/tgs.dm
index 3225f14d8c..e1eac9f291 100644
--- a/src/DMAPI/tgs.dm
+++ b/src/DMAPI/tgs.dm
@@ -1,6 +1,6 @@
// tgstation-server DMAPI
-#define TGS_DMAPI_VERSION "5.2.10"
+#define TGS_DMAPI_VERSION "5.2.11"
// All functions and datums outside this document are subject to change with any version and should not be relied on.
@@ -97,6 +97,8 @@
#define TGS_EVENT_WATCHDOG_DETACH 16
// We don't actually implement this value as the DMAPI can never receive it
// #define TGS_EVENT_WATCHDOG_LAUNCH 17
+// Same here. We don't actually implement this value as the DMAPI can never receive it
+// #define TGS_EVENT_WORLD_END_PROCESS 18
// OTHER ENUMS
diff --git a/src/Tgstation.Server.Host/Components/Events/EventType.cs b/src/Tgstation.Server.Host/Components/Events/EventType.cs
index 9085c6e215..f22c1db8e0 100644
--- a/src/Tgstation.Server.Host/Components/Events/EventType.cs
+++ b/src/Tgstation.Server.Host/Components/Events/EventType.cs
@@ -111,6 +111,12 @@ namespace Tgstation.Server.Host.Components.Events
/// Before the watchdog launches. No parameters.
///
[EventScript("WatchdogLaunch")]
- WatchdogLaunch
+ WatchdogLaunch,
+
+ ///
+ /// In between DD restarts if the process has been force-ended by the DMAPI (TgsEndProcess())
+ ///
+ [EventScript("WorldEndProcess")]
+ WorldEndProcess,
}
}
diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
index c364a8cf65..433680a941 100644
--- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
+++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging;
using System;
using System.Globalization;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api.Models.Internal;
@@ -91,6 +92,9 @@ namespace Tgstation.Server.Host.Components.Watchdog
switch (reason)
{
case MonitorActivationReason.ActiveServerCrashed:
+ if (Server.TerminationWasRequested)
+ await EventConsumer.HandleEvent(EventType.WorldEndProcess, Enumerable.Empty(), cancellationToken).ConfigureAwait(false);
+
string exitWord = Server.TerminationWasRequested ? "exited" : "crashed";
if (Server.RebootState == Session.RebootState.Shutdown)
{
diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
index 5a24b01076..f6a7ed6160 100644
--- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
+++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs
@@ -83,6 +83,11 @@ namespace Tgstation.Server.Host.Components.Watchdog
///
protected IAsyncDelayer AsyncDelayer { get; }
+ ///
+ /// The that is not the
+ ///
+ protected IEventConsumer EventConsumer { get; }
+
///
/// The for the .
///
@@ -118,11 +123,6 @@ namespace Tgstation.Server.Host.Components.Watchdog
///
readonly IIOManager diagnosticsIOManager;
- ///
- /// The that is not the
- ///
- readonly IEventConsumer eventConsumer;
-
///
/// The for the .
///
@@ -179,7 +179,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// The to populate with
/// The value of .
/// The value of .
- /// The value of .
+ /// The value of .
/// The value of .
/// The value of
/// The initial value of . May be modified
@@ -208,7 +208,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
AsyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager));
- this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
+ EventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
ActiveLaunchParameters = initialLaunchParameters ?? throw new ArgumentNullException(nameof(initialLaunchParameters));
@@ -267,7 +267,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
return;
if (!graceful)
{
- var eventTask = eventConsumer.HandleEvent(releaseServers ? EventType.WatchdogDetach : EventType.WatchdogShutdown, null, cancellationToken);
+ var eventTask = EventConsumer.HandleEvent(releaseServers ? EventType.WatchdogDetach : EventType.WatchdogShutdown, null, cancellationToken);
var chatTask = announce ? Chat.QueueWatchdogMessage("Shutting down...", cancellationToken) : Task.CompletedTask;
@@ -378,7 +378,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
cancellationToken); // simple announce
if (reattachInfo == null)
announceTask = Task.WhenAll(
- eventConsumer.HandleEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken),
+ EventConsumer.HandleEvent(EventType.WatchdogLaunch, Enumerable.Empty(), cancellationToken),
announceTask);
}
else