Fix RuntimeInformation after reattach having null SecurityLevel and Visibility

This commit is contained in:
Jordan Dominion
2023-10-20 23:48:14 -04:00
parent 2f5e62c9a0
commit a6cb81902f
6 changed files with 22 additions and 17 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
<TgsApiLibraryVersion>11.1.2</TgsApiLibraryVersion>
<TgsClientVersion>12.1.2</TgsClientVersion>
<TgsDmapiVersion>6.5.4</TgsDmapiVersion>
<TgsInteropVersion>5.6.1</TgsInteropVersion>
<TgsInteropVersion>5.6.2</TgsInteropVersion>
<TgsHostWatchdogVersion>1.4.0</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
<TgsMigratorVersion>1.0.2</TgsMigratorVersion>
+1 -1
View File
@@ -1 +1 @@
"5.6.1"
"5.6.2"
@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Host.Components.Chat;
using Tgstation.Server.Host.Components.Deployment;
@@ -42,12 +44,14 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level of the launch.
/// </summary>
public DreamDaemonSecurity? SecurityLevel { get; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public DreamDaemonSecurity SecurityLevel { get; }
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level of the launch.
/// </summary>
public DreamDaemonVisibility? Visibility { get; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public DreamDaemonVisibility Visibility { get; }
/// <summary>
/// The <see cref="TestMergeInformation"/>s in the launch.
@@ -70,8 +74,8 @@ namespace Tgstation.Server.Host.Components.Interop.Bridge
IDmbProvider dmbProvider,
Version serverVersion,
string instanceName,
DreamDaemonSecurity? securityLevel,
DreamDaemonVisibility? visibility,
DreamDaemonSecurity securityLevel,
DreamDaemonVisibility visibility,
ushort serverPort,
bool apiValidateOnly)
: base(chatTrackingContext?.Channels ?? throw new ArgumentNullException(nameof(chatTrackingContext)))
@@ -76,13 +76,11 @@ namespace Tgstation.Server.Host.Components.Session
Dmb = dmb ?? throw new ArgumentNullException(nameof(dmb));
ProcessId = process?.Id ?? throw new ArgumentNullException(nameof(process));
RuntimeInformation = runtimeInformation ?? throw new ArgumentNullException(nameof(runtimeInformation));
if (!runtimeInformation.SecurityLevel.HasValue)
throw new ArgumentException("runtimeInformation must have a valid SecurityLevel!", nameof(runtimeInformation));
AccessIdentifier = accessIdentifier ?? throw new ArgumentNullException(nameof(accessIdentifier));
LaunchSecurityLevel = runtimeInformation.SecurityLevel.Value;
LaunchVisibility = runtimeInformation.Visibility.Value;
LaunchSecurityLevel = runtimeInformation.SecurityLevel;
LaunchVisibility = runtimeInformation.Visibility;
Port = port;
runtimeInformationLock = new object();
@@ -336,7 +336,8 @@ namespace Tgstation.Server.Host.Components.Session
var runtimeInformation = CreateRuntimeInformation(
dmbProvider,
chatTrackingContext,
launchParameters,
launchParameters.SecurityLevel.Value,
launchParameters.Visibility.Value,
apiValidate);
var reattachInformation = new ReattachInformation(
@@ -430,7 +431,8 @@ namespace Tgstation.Server.Host.Components.Session
var runtimeInformation = CreateRuntimeInformation(
reattachInformation.Dmb,
chatTrackingContext,
null,
reattachInformation.LaunchSecurityLevel,
reattachInformation.LaunchVisibility,
false);
reattachInformation.SetRuntimeInformation(runtimeInformation);
@@ -632,15 +634,16 @@ namespace Tgstation.Server.Host.Components.Session
RuntimeInformation CreateRuntimeInformation(
IDmbProvider dmbProvider,
IChatTrackingContext chatTrackingContext,
DreamDaemonLaunchParameters launchParameters,
DreamDaemonSecurity securityLevel,
DreamDaemonVisibility visibility,
bool apiValidateOnly)
=> new (
chatTrackingContext,
dmbProvider,
assemblyInformationProvider.Version,
instance.Name,
launchParameters?.SecurityLevel,
launchParameters?.Visibility,
securityLevel,
visibility,
serverPortProvider.HttpApiPort,
apiValidateOnly);
@@ -32,13 +32,13 @@ namespace Tgstation.Server.Host.Models
/// The <see cref="DreamDaemonSecurity"/> level DreamDaemon was launched with.
/// </summary>
[Required]
public DreamDaemonSecurity? LaunchSecurityLevel { get; set; }
public DreamDaemonSecurity LaunchSecurityLevel { get; set; }
/// <summary>
/// The <see cref="DreamDaemonVisibility"/> DreamDaemon was launched with.
/// </summary>
[Required]
public DreamDaemonVisibility? LaunchVisibility { get; set; }
public DreamDaemonVisibility LaunchVisibility { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ReattachInformationBase"/> class.