Patch the watchdog shutdown crash

This commit is contained in:
Jordan Brown
2020-05-18 16:35:39 -04:00
parent e180dcb279
commit bc434d1df6
@@ -147,6 +147,11 @@ namespace Tgstation.Server.Host.Components.Watchdog
/// </summary>
bool running;
/// <summary>
/// If the <see cref="WatchdogBase"/> has been <see cref="Dispose"/>d.
/// </summary>
bool disposed;
/// <summary>
/// Initializes a new instance of the <see cref="WatchdogBase"/> <see langword="class"/>.
/// </summary>
@@ -216,6 +221,7 @@ namespace Tgstation.Server.Host.Components.Watchdog
restartRegistration.Dispose();
DisposeAndNullControllers();
monitorCts?.Dispose();
disposed = true;
}
/// <summary>
@@ -672,7 +678,9 @@ namespace Tgstation.Server.Host.Components.Watchdog
false,
cancellationToken);
if (monitorState.NextAction != MonitorAction.Exit)
if (disposed)
monitorState.NextAction = MonitorAction.Exit;
else if (monitorState.NextAction != MonitorAction.Exit)
monitorState = await MonitorRestart(cancellationToken).ConfigureAwait(false);
await chatTask.ConfigureAwait(false);