From b40b077b0a22b7196e288c790b3aa7eeeed6728a Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 13 Jun 2020 13:22:37 -0400 Subject: [PATCH] Actually give WatchdogBase the Diagnostics IIOManager --- .../Components/InstanceFactory.cs | 2 ++ .../Components/Watchdog/BasicWatchdog.cs | 4 ++++ .../Watchdog/ExperimentalWatchdog.cs | 4 ++++ .../Components/Watchdog/IWatchdogFactory.cs | 6 ++++-- .../Components/Watchdog/WatchdogBase.cs | 3 +++ .../Components/Watchdog/WatchdogFactory.cs | 21 +++++++++++++++---- .../Components/Watchdog/WindowsWatchdog.cs | 17 ++++++++------- .../Watchdog/WindowsWatchdogFactory.cs | 6 ++++-- 8 files changed, 48 insertions(+), 15 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/InstanceFactory.cs b/src/Tgstation.Server.Host/Components/InstanceFactory.cs index 844aa5c264..15876d33cd 100644 --- a/src/Tgstation.Server.Host/Components/InstanceFactory.cs +++ b/src/Tgstation.Server.Host/Components/InstanceFactory.cs @@ -202,6 +202,7 @@ namespace Tgstation.Server.Host.Components var repoIoManager = new ResolvingIOManager(instanceIoManager, "Repository"); var byondIOManager = new ResolvingIOManager(instanceIoManager, "Byond"); var gameIoManager = new ResolvingIOManager(instanceIoManager, "Game"); + var diagnosticsIOManager = new ResolvingIOManager(instanceIoManager, "Diagnostics"); var configurationIoManager = new ResolvingIOManager(instanceIoManager, "Configuration"); var configuration = new StaticFiles.Configuration(configurationIoManager, synchronousIOManager, symlinkFactory, processExecutor, postWriteHandler, platformIdentifier, loggerFactory.CreateLogger()); @@ -248,6 +249,7 @@ namespace Tgstation.Server.Host.Components reattachInfoHandler, sessionControllerFactory, gameIoManager, + diagnosticsIOManager, metadata.CloneMetadata(), metadata.DreamDaemonSettings); eventConsumer.SetWatchdog(watchdog); diff --git a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs index 96fbbbdf30..73d7a74d22 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/BasicWatchdog.cs @@ -10,6 +10,7 @@ using Tgstation.Server.Host.Components.Deployment; using Tgstation.Server.Host.Components.Session; using Tgstation.Server.Host.Core; using Tgstation.Server.Host.Database; +using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Jobs; namespace Tgstation.Server.Host.Components.Watchdog @@ -49,6 +50,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the . /// The for the . /// The for the . + /// The for the . /// The for the . /// The for the . /// The for the . @@ -62,6 +64,7 @@ namespace Tgstation.Server.Host.Components.Watchdog IJobManager jobManager, IServerControl serverControl, IAsyncDelayer asyncDelayer, + IIOManager diagnosticsIOManager, ILogger logger, DreamDaemonLaunchParameters initialLaunchParameters, Api.Models.Instance instance, @@ -75,6 +78,7 @@ namespace Tgstation.Server.Host.Components.Watchdog jobManager, serverControl, asyncDelayer, + diagnosticsIOManager, logger, initialLaunchParameters, instance, diff --git a/src/Tgstation.Server.Host/Components/Watchdog/ExperimentalWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/ExperimentalWatchdog.cs index a399db4e8d..0addffef36 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/ExperimentalWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/ExperimentalWatchdog.cs @@ -11,6 +11,7 @@ using Tgstation.Server.Host.Components.Deployment; using Tgstation.Server.Host.Components.Session; using Tgstation.Server.Host.Core; using Tgstation.Server.Host.Database; +using Tgstation.Server.Host.IO; using Tgstation.Server.Host.Jobs; namespace Tgstation.Server.Host.Components.Watchdog @@ -60,6 +61,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the . /// The for the . /// The for the . + /// The for the . /// The for the . /// The for the . /// The for the . @@ -73,6 +75,7 @@ namespace Tgstation.Server.Host.Components.Watchdog IJobManager jobManager, IServerControl serverControl, IAsyncDelayer asyncDelayer, + IIOManager diagnosticsIOManager, ILogger logger, DreamDaemonLaunchParameters initialLaunchParameters, Api.Models.Instance instance, bool autoStart) @@ -85,6 +88,7 @@ namespace Tgstation.Server.Host.Components.Watchdog jobManager, serverControl, asyncDelayer, + diagnosticsIOManager, logger, initialLaunchParameters, instance, diff --git a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs index 4734c17f85..63f30ec362 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/IWatchdogFactory.cs @@ -18,7 +18,8 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the with /// The for the /// The for the - /// The for the . + /// The pointing to the Game directory for the . + /// The pointing to the Diagnostics directory for the . /// The for the /// The initial for the /// A new @@ -27,7 +28,8 @@ namespace Tgstation.Server.Host.Components.Watchdog IDmbFactory dmbFactory, IReattachInfoHandler reattachInfoHandler, ISessionControllerFactory sessionControllerFactory, - IIOManager ioManager, + IIOManager gameIOManager, + IIOManager diagnosticsIOManager, Api.Models.Instance instance, DreamDaemonSettings settings); } diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs index af48e18841..d8e6139afa 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogBase.cs @@ -176,6 +176,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The value of /// The to populate with /// The value of . + /// The value of . /// The value of /// The initial value of . May be modified /// The value of @@ -189,6 +190,7 @@ namespace Tgstation.Server.Host.Components.Watchdog IJobManager jobManager, IServerControl serverControl, IAsyncDelayer asyncDelayer, + IIOManager diagnosticsIOManager, ILogger logger, DreamDaemonLaunchParameters initialLaunchParameters, Api.Models.Instance instance, @@ -201,6 +203,7 @@ namespace Tgstation.Server.Host.Components.Watchdog this.databaseContextFactory = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory)); this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager)); AsyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer)); + this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager)); Logger = logger ?? throw new ArgumentNullException(nameof(logger)); ActiveLaunchParameters = initialLaunchParameters ?? throw new ArgumentNullException(nameof(initialLaunchParameters)); this.instance = instance ?? throw new ArgumentNullException(nameof(instance)); diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs index 7f5f08e88e..b7fcaaa3bd 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs @@ -77,7 +77,8 @@ namespace Tgstation.Server.Host.Components.Watchdog IDmbFactory dmbFactory, IReattachInfoHandler reattachInfoHandler, ISessionControllerFactory sessionControllerFactory, - IIOManager ioManager, + IIOManager gameIOManager, + IIOManager diagnosticsIOManager, Api.Models.Instance instance, DreamDaemonSettings settings) { @@ -91,12 +92,21 @@ namespace Tgstation.Server.Host.Components.Watchdog JobManager, ServerControl, AsyncDelayer, + diagnosticsIOManager, LoggerFactory.CreateLogger(), settings, instance, settings.AutoStart.Value); - return CreateNonExperimentalWatchdog(chat, dmbFactory, reattachInfoHandler, sessionControllerFactory, ioManager, instance, settings); + return CreateNonExperimentalWatchdog( + chat, + dmbFactory, + reattachInfoHandler, + sessionControllerFactory, + gameIOManager, + diagnosticsIOManager, + instance, + settings); } /// @@ -106,7 +116,8 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the with /// The for the /// The for the - /// The for the . + /// The pointing to the Game directory for the . + /// The pointing to the Diagnostics directory for the . /// The for the /// The initial for the /// A new @@ -115,7 +126,8 @@ namespace Tgstation.Server.Host.Components.Watchdog IDmbFactory dmbFactory, IReattachInfoHandler reattachInfoHandler, ISessionControllerFactory sessionControllerFactory, - IIOManager ioManager, + IIOManager gameIOManager, + IIOManager diagnosticsIOManager, Api.Models.Instance instance, DreamDaemonSettings settings) => new BasicWatchdog( @@ -127,6 +139,7 @@ namespace Tgstation.Server.Host.Components.Watchdog JobManager, ServerControl, AsyncDelayer, + diagnosticsIOManager, LoggerFactory.CreateLogger(), settings, instance, diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdog.cs index 473b3f36cc..206995886c 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdog.cs @@ -19,9 +19,9 @@ namespace Tgstation.Server.Host.Components.Watchdog sealed class WindowsWatchdog : BasicWatchdog { /// - /// The for the . + /// The for the pointing to the Game directory. /// - readonly IIOManager ioManager; + readonly IIOManager gameIOManager; /// /// The for the . @@ -54,7 +54,8 @@ namespace Tgstation.Server.Host.Components.Watchdog /// The for the . /// The for the . /// The for the . - /// The value of . + /// The for the . + /// The value of . /// The value of . /// The for the . /// The for the . @@ -69,7 +70,8 @@ namespace Tgstation.Server.Host.Components.Watchdog IJobManager jobManager, IServerControl serverControl, IAsyncDelayer asyncDelayer, - IIOManager ioManager, + IIOManager diagnosticsIOManager, + IIOManager gameIOManager, ISymlinkFactory symlinkFactory, ILogger logger, DreamDaemonLaunchParameters initialLaunchParameters, @@ -83,6 +85,7 @@ namespace Tgstation.Server.Host.Components.Watchdog jobManager, serverControl, asyncDelayer, + diagnosticsIOManager, logger, initialLaunchParameters, instance, @@ -90,7 +93,7 @@ namespace Tgstation.Server.Host.Components.Watchdog { try { - this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager)); + this.gameIOManager = gameIOManager ?? throw new ArgumentNullException(nameof(gameIOManager)); this.symlinkFactory = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory)); } catch @@ -151,7 +154,7 @@ namespace Tgstation.Server.Host.Components.Watchdog bool suspended = false; try { - windowsProvider = new WindowsSwappableDmbProvider(compileJobProvider, ioManager, symlinkFactory); + windowsProvider = new WindowsSwappableDmbProvider(compileJobProvider, gameIOManager, symlinkFactory); Logger.LogDebug("Swapping to compile job {0}...", windowsProvider.CompileJob.Id); try @@ -195,7 +198,7 @@ namespace Tgstation.Server.Host.Components.Watchdog // Add another lock to the startup DMB because it'll be used throughout the lifetime of the watchdog startupDmbProvider = await DmbFactory.FromCompileJob(dmbToUse.CompileJob, cancellationToken).ConfigureAwait(false); - activeSwappable = pendingSwappable ?? new WindowsSwappableDmbProvider(dmbToUse, ioManager, symlinkFactory); + activeSwappable = pendingSwappable ?? new WindowsSwappableDmbProvider(dmbToUse, gameIOManager, symlinkFactory); pendingSwappable = null; try diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdogFactory.cs index 2d8273386d..d8c4314280 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdogFactory.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WindowsWatchdogFactory.cs @@ -58,7 +58,8 @@ namespace Tgstation.Server.Host.Components.Watchdog IDmbFactory dmbFactory, IReattachInfoHandler reattachInfoHandler, ISessionControllerFactory sessionControllerFactory, - IIOManager ioManager, + IIOManager gameIOManager, + IIOManager diagnosticsIOManager, Api.Models.Instance instance, DreamDaemonSettings settings) => new WindowsWatchdog( @@ -70,7 +71,8 @@ namespace Tgstation.Server.Host.Components.Watchdog JobManager, ServerControl, AsyncDelayer, - ioManager, + diagnosticsIOManager, + gameIOManager, symlinkFactory, LoggerFactory.CreateLogger(), settings,