From 59b855156b2a3da9169b99bbceb3411db8faa259 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 10 Jul 2018 12:05:58 -0400 Subject: [PATCH] Fix release build --- .../Rights/DreamDaemonRights.cs | 2 +- .../Components/Chat/IChatJsonTrackingContext.cs | 3 +++ .../Components/DreamMaker.cs | 8 +++----- .../Components/IInstance.cs | 1 + .../Components/IInstanceManager.cs | 1 + .../Components/IInteropRegistrar.cs | 2 +- .../Components/Watchdog/IExecutor.cs | 2 +- .../Components/Watchdog/ISessionController.cs | 10 ++++++---- .../Components/Watchdog/LaunchResult.cs | 2 +- .../Components/Watchdog/ReattachInformation.cs | 9 +++++++++ .../Components/Watchdog/Watchdog.cs | 16 ++++++++-------- .../Components/Watchdog/WatchdogFactory.cs | 2 +- .../Watchdog/WatchdogReattachInformation.cs | 9 +++++++++ ...maphoreContext.cs => SemaphoreSlimContext.cs} | 10 +++++----- .../Models/DreamDaemonSettings.cs | 11 ++++++++--- .../Models/ReattachInformationBase.cs | 11 +++++++++-- .../Models/WatchdogReattachInformationBase.cs | 13 ++++++++++++- 17 files changed, 79 insertions(+), 33 deletions(-) rename src/Tgstation.Server.Host/Core/{SemaphoreContext.cs => SemaphoreSlimContext.cs} (80%) diff --git a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs index 0bcf055335..86665af07b 100644 --- a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs +++ b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs @@ -13,7 +13,7 @@ namespace Tgstation.Server.Api.Rights /// None = 0, /// - /// User can read + /// User can read and /// ReadRevision = 1, /// diff --git a/src/Tgstation.Server.Host/Components/Chat/IChatJsonTrackingContext.cs b/src/Tgstation.Server.Host/Components/Chat/IChatJsonTrackingContext.cs index 510f922617..8926b33291 100644 --- a/src/Tgstation.Server.Host/Components/Chat/IChatJsonTrackingContext.cs +++ b/src/Tgstation.Server.Host/Components/Chat/IChatJsonTrackingContext.cs @@ -2,6 +2,9 @@ namespace Tgstation.Server.Host.Components.Chat { + /// + /// Represents a tracking of dynamic chat json files + /// public interface IChatJsonTrackingContext : IDisposable { } diff --git a/src/Tgstation.Server.Host/Components/DreamMaker.cs b/src/Tgstation.Server.Host/Components/DreamMaker.cs index 2dafc3b983..e51b301ef0 100644 --- a/src/Tgstation.Server.Host/Components/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/DreamMaker.cs @@ -67,8 +67,7 @@ namespace Tgstation.Server.Host.Components /// The value of /// The value of /// The value of - /// The value of - /// The value of + /// The value of /// The value of /// The value of /// @@ -85,12 +84,11 @@ namespace Tgstation.Server.Host.Components /// /// Run a quick DD instance to test the DMAPI is installed on the target code /// - /// The path to the DreamDaemon executable /// The timeout in seconds for validation /// The for the operation /// The for the operation /// A resulting in if the DMAPI was successfully validated, otherwise - async Task VerifyApi(string dreamDaemonPath, int timeout, Models.CompileJob job, CancellationToken cancellationToken) + async Task VerifyApi(int timeout, Models.CompileJob job, CancellationToken cancellationToken) { var launchParameters = new DreamDaemonLaunchParameters { @@ -268,7 +266,7 @@ namespace Tgstation.Server.Host.Components Status = CompilerStatus.Verifying; - ddVerified = job.ExitCode == 0 && await VerifyApi(byondLock.DreamDaemonPath, apiValidateTimeout, job, cancellationToken).ConfigureAwait(false); + ddVerified = job.ExitCode == 0 && await VerifyApi(apiValidateTimeout, job, cancellationToken).ConfigureAwait(false); } if (!ddVerified) diff --git a/src/Tgstation.Server.Host/Components/IInstance.cs b/src/Tgstation.Server.Host/Components/IInstance.cs index 3f8beaadb4..54cd4468d6 100644 --- a/src/Tgstation.Server.Host/Components/IInstance.cs +++ b/src/Tgstation.Server.Host/Components/IInstance.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.Hosting; using System.Threading.Tasks; +using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Components.Watchdog; namespace Tgstation.Server.Host.Components diff --git a/src/Tgstation.Server.Host/Components/IInstanceManager.cs b/src/Tgstation.Server.Host/Components/IInstanceManager.cs index 1eb1454dd2..ca949b42a7 100644 --- a/src/Tgstation.Server.Host/Components/IInstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/IInstanceManager.cs @@ -45,6 +45,7 @@ namespace Tgstation.Server.Host.Components /// Handle a GET via world/Export /// /// The request query + /// The for the operation /// A resulting in an graph that can be jsonified Task HandleWorldExport(IQueryCollection query, CancellationToken cancellationToken); } diff --git a/src/Tgstation.Server.Host/Components/IInteropRegistrar.cs b/src/Tgstation.Server.Host/Components/IInteropRegistrar.cs index 9298a67236..92f7d601dd 100644 --- a/src/Tgstation.Server.Host/Components/IInteropRegistrar.cs +++ b/src/Tgstation.Server.Host/Components/IInteropRegistrar.cs @@ -1,7 +1,7 @@ namespace Tgstation.Server.Host.Components { /// - /// Creates s for + /// Creates s for s /// interface IInteropRegistrar { diff --git a/src/Tgstation.Server.Host/Components/Watchdog/IExecutor.cs b/src/Tgstation.Server.Host/Components/Watchdog/IExecutor.cs index b27a06a78f..84e2232bd3 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/IExecutor.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/IExecutor.cs @@ -11,11 +11,11 @@ namespace Tgstation.Server.Host.Components.Watchdog /// Run a dream daemon instance /// /// The - /// The that is completed when dream daemon starts without crashing /// The for the new /// The for the .dmb to run /// The value of the -params command line option /// If the field of should be used + /// If the field of should be used /// A new ISession RunDreamDaemon(DreamDaemonLaunchParameters launchParameters, IByondExecutableLock byondLock, IDmbProvider dmbProvider, string parameters, bool useSecondaryPort, bool useSecondaryDirectory); diff --git a/src/Tgstation.Server.Host/Components/Watchdog/ISessionController.cs b/src/Tgstation.Server.Host/Components/Watchdog/ISessionController.cs index efae086297..949e1b53d9 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/ISessionController.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/ISessionController.cs @@ -44,7 +44,7 @@ namespace Tgstation.Server.Host.Components.Watchdog Task OnReboot { get; } /// - /// Releases the without terminating it. Also calls + /// Releases the without terminating it. Also calls /// /// which can be used to create a new similar to this one ReattachInformation Release(); @@ -52,20 +52,22 @@ namespace Tgstation.Server.Host.Components.Watchdog /// /// Sends a command to DreamDaemon through /world/Topic() /// - /// The for the operation + /// The command to send + /// The for the operation /// A resulting in the result of /world/Topic() Task SendCommand(string command, CancellationToken cancellationToken); /// /// Closes the world's port /// - /// The for the operation + /// The for the operation /// A resulting in if the operation succeeded, otherwise Task ClosePort(CancellationToken cancellationToken); /// /// Causes the world to start listening on a /// + /// The port to change to /// The for the operation /// A resulting in if the operation succeeded, otherwise Task SetPort(ushort newPort, CancellationToken cancellatonToken); @@ -74,7 +76,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// Attempts to change the current to /// /// The new - /// The for the operation + /// The for the operation /// A resulting in if the operation succeeded, otherwise Task SetRebootState(RebootState newRebootState, CancellationToken cancellationToken); } diff --git a/src/Tgstation.Server.Host/Components/Watchdog/LaunchResult.cs b/src/Tgstation.Server.Host/Components/Watchdog/LaunchResult.cs index 539181995f..3e8c3d51b4 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/LaunchResult.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/LaunchResult.cs @@ -9,7 +9,7 @@ namespace Tgstation.Server.Host.Components.Watchdog public sealed class LaunchResult { /// - /// The time it took for to return + /// The time it took for to return /// public TimeSpan StartupTime { get; set; } diff --git a/src/Tgstation.Server.Host/Components/Watchdog/ReattachInformation.cs b/src/Tgstation.Server.Host/Components/Watchdog/ReattachInformation.cs index 16c1319ba3..6ede61b0b6 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/ReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/ReattachInformation.cs @@ -12,7 +12,16 @@ namespace Tgstation.Server.Host.Components.Watchdog /// public IDmbProvider Dmb { get; set; } + /// + /// Construct a + /// public ReattachInformation() { } + + /// + /// Construct a from a given and + /// + /// The to copy values from + /// The used to assign public ReattachInformation(Models.ReattachInformation copy, IDmbFactory dmbFactory) : base(copy) { Dmb = dmbFactory.FromCompileJob(copy.CompileJob); diff --git a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs index b03163fbc0..445ac39386 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/Watchdog.cs @@ -177,7 +177,7 @@ namespace Tgstation.Server.Host.Components.Watchdog { logger.LogInformation("Monitor activation. Reason: {0}", activationReason); await Task.Yield(); - throw new NotImplementedException(); + throw new NotImplementedException(nameof(monitorState)); } /// @@ -224,7 +224,7 @@ namespace Tgstation.Server.Host.Components.Watchdog } var chatTask = Task.CompletedTask; - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) { MonitorActivationReason activationReason = default; //multiple things may have happened, handle them one at a time @@ -276,7 +276,7 @@ namespace Tgstation.Server.Host.Components.Watchdog for (var retryAttempts = 1; state.NextAction == MonitorAction.Restart; ++retryAttempts) { WatchdogLaunchResult result; - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) result = await LaunchNoLock(false, false, false, cancellationToken).ConfigureAwait(false); await chatTask.ConfigureAwait(false); @@ -320,7 +320,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// public async Task ChangeSettings(DreamDaemonLaunchParameters launchParameters, CancellationToken cancellationToken) { - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) { ActiveLaunchParameters = launchParameters; if (Running) @@ -462,21 +462,21 @@ namespace Tgstation.Server.Host.Components.Watchdog /// public async Task Launch(CancellationToken cancellationToken) { - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) return await LaunchNoLock(true, true, false, cancellationToken).ConfigureAwait(false); } /// public async Task Restart(bool graceful, CancellationToken cancellationToken) { - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) return await RestartNoLock(graceful, cancellationToken).ConfigureAwait(false); } /// public async Task Terminate(bool graceful, CancellationToken cancellationToken) { - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) await TerminateNoLock(graceful, true, cancellationToken).ConfigureAwait(false); } @@ -499,7 +499,7 @@ namespace Tgstation.Server.Host.Components.Watchdog /// public async Task HandleEvent(EventType eventType, IEnumerable parameters, CancellationToken cancellationToken) { - using (await SemaphoreContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) + using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false)) { if (!Running) return; diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs index 638f5f6940..2f666ad6be 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogFactory.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.Logging; using System; using Tgstation.Server.Api.Models.Internal; +using Tgstation.Server.Host.Components.Chat; using Tgstation.Server.Host.Core; namespace Tgstation.Server.Host.Components.Watchdog @@ -36,7 +37,6 @@ namespace Tgstation.Server.Host.Components.Watchdog /// /// Construct a /// - /// The value of /// The value of /// The value of /// The value of diff --git a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogReattachInformation.cs b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogReattachInformation.cs index a43408e6b4..0dd94f8ba5 100644 --- a/src/Tgstation.Server.Host/Components/Watchdog/WatchdogReattachInformation.cs +++ b/src/Tgstation.Server.Host/Components/Watchdog/WatchdogReattachInformation.cs @@ -18,7 +18,16 @@ namespace Tgstation.Server.Host.Components.Watchdog /// public ReattachInformation Bravo { get; set; } + /// + /// Construct a + /// public WatchdogReattachInformation() { } + + /// + /// Construct a from a given with a given + /// + /// The to copy information from + /// The used to build the s public WatchdogReattachInformation(Models.WatchdogReattachInformation copy, IDmbFactory dmbFactory): base(copy) { if (copy.Alpha != null) diff --git a/src/Tgstation.Server.Host/Core/SemaphoreContext.cs b/src/Tgstation.Server.Host/Core/SemaphoreSlimContext.cs similarity index 80% rename from src/Tgstation.Server.Host/Core/SemaphoreContext.cs rename to src/Tgstation.Server.Host/Core/SemaphoreSlimContext.cs index f2665250d8..81b5d76d67 100644 --- a/src/Tgstation.Server.Host/Core/SemaphoreContext.cs +++ b/src/Tgstation.Server.Host/Core/SemaphoreSlimContext.cs @@ -7,7 +7,7 @@ namespace Tgstation.Server.Host.Core /// /// Async lock context helper /// - public sealed class SemaphoreContext : IDisposable + public sealed class SemaphoreSlimContext : IDisposable { /// /// Asyncronously locks a @@ -15,13 +15,13 @@ namespace Tgstation.Server.Host.Core /// The to lock /// The for the operation /// A resulting in the for the lock - public static async Task Lock(SemaphoreSlim semaphore, CancellationToken cancellationToken) + public static async Task Lock(SemaphoreSlim semaphore, CancellationToken cancellationToken) { if (semaphore == null) throw new ArgumentNullException(nameof(semaphore)); await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); - return new SemaphoreContext(semaphore); + return new SemaphoreSlimContext(semaphore); } /// @@ -38,12 +38,12 @@ namespace Tgstation.Server.Host.Core /// Construct a /// /// The value of - SemaphoreContext(SemaphoreSlim lockedSemaphore) => this.lockedSemaphore = lockedSemaphore; + SemaphoreSlimContext(SemaphoreSlim lockedSemaphore) => this.lockedSemaphore = lockedSemaphore; /// /// Finalize the /// - ~SemaphoreContext() => Dispose(); + ~SemaphoreSlimContext() => Dispose(); /// /// Release the lock on diff --git a/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs b/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs index 6a1a550a42..af817a1825 100644 --- a/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs +++ b/src/Tgstation.Server.Host/Models/DreamDaemonSettings.cs @@ -32,8 +32,13 @@ namespace Tgstation.Server.Host.Models public Instance Instance { get; set; } /// - /// See + /// See /// - public CompileJob CompileJob { get; set; } - } + public CompileJob ActiveCompileJob { get; set; } + + /// + /// See + /// + public CompileJob StagedCompileJob { get; set; } + } } diff --git a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs index defb570cd6..b0c8f7dcb7 100644 --- a/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs +++ b/src/Tgstation.Server.Host/Models/ReattachInformationBase.cs @@ -7,7 +7,7 @@ namespace Tgstation.Server.Host.Models /// /// Base class for /// - public class ReattachInformationBase + public abstract class ReattachInformationBase { /// /// Used to identify and authenticate the DreamDaemon instance @@ -21,7 +21,7 @@ namespace Tgstation.Server.Host.Models public int ProcessId { get; set; } /// - /// If the of is being used + /// If the of the associated dmb is being used /// public bool IsPrimary { get; set; } @@ -48,8 +48,15 @@ namespace Tgstation.Server.Host.Models [Required] public string ChatChannelsJson { get; set; } + /// + /// Construct a + /// public ReattachInformationBase() { } + /// + /// Construct a from a given + /// + /// The to copy values from protected ReattachInformationBase(ReattachInformationBase copy) { if (copy == null) diff --git a/src/Tgstation.Server.Host/Models/WatchdogReattachInformationBase.cs b/src/Tgstation.Server.Host/Models/WatchdogReattachInformationBase.cs index 2d578f2915..8cfa201257 100644 --- a/src/Tgstation.Server.Host/Models/WatchdogReattachInformationBase.cs +++ b/src/Tgstation.Server.Host/Models/WatchdogReattachInformationBase.cs @@ -2,14 +2,25 @@ namespace Tgstation.Server.Host.Models { - public class WatchdogReattachInformationBase + /// + /// Base class for + /// + public abstract class WatchdogReattachInformationBase { /// /// If the Alpha session is the active session /// public bool AlphaIsActive { get; set; } + /// + /// Construct a + /// public WatchdogReattachInformationBase() { } + + /// + /// Construct a from a given + /// + /// The to copy values from protected WatchdogReattachInformationBase(WatchdogReattachInformationBase copy) { AlphaIsActive = copy?.AlphaIsActive ?? throw new ArgumentNullException(nameof(copy));