tgstation-server 6.19.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
SessionControllerFactory.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using System.Net.Sockets;
6using System.Text;
7using System.Threading;
8using System.Threading.Tasks;
9
10using Microsoft.Extensions.Logging;
11using Microsoft.Extensions.Options;
12
13using Prometheus;
14
32
34{
37 {
41 const string DreamDaemonLogsPath = "DreamDaemonLogs";
42
47
52
57
62
67
72
77
82
87
92
97
102
107
112
117
121 readonly ILoggerFactory loggerFactory;
122
126 readonly IOptionsMonitor<SessionConfiguration> sessionConfigurationOptions;
127
131 readonly ILogger<SessionControllerFactory> logger;
132
136 readonly Counter sessionsLaunched;
137
141 readonly Gauge lastSessionLaunch;
142
147
155 async ValueTask PortBindTest(ushort port, EngineType engineType, CancellationToken cancellationToken)
156 {
157 logger.LogTrace("Bind test: {port}", port);
158 try
159 {
160 // GIVE ME THE FUCKING PORT BACK WINDOWS!!!!
161 const int MaxAttempts = 5;
162 for (var i = 0; i < MaxAttempts; ++i)
163 try
164 {
165 SocketExtensions.BindTest(platformIdentifier, port, false, engineType == EngineType.OpenDream);
166 if (i > 0)
167 logger.LogDebug("Clearing the socket took {iterations} attempts :/", i + 1);
168
169 break;
170 }
171 catch (SocketException ex) when (platformIdentifier.IsWindows && ex.SocketErrorCode == SocketError.AddressAlreadyInUse && i < (MaxAttempts - 1))
172 {
173 await asyncDelayer.Delay(TimeSpan.FromSeconds(1), cancellationToken);
174 }
175 }
176 catch (SocketException ex) when (ex.SocketErrorCode == SocketError.AddressAlreadyInUse)
177 {
178 throw new JobException(ErrorCode.GameServerPortInUse, ex);
179 }
180 }
181
221 IMetricFactory metricFactory,
222 ILoggerFactory loggerFactory,
223 IOptionsMonitor<SessionConfiguration> sessionConfigurationOptions,
224 ILogger<SessionControllerFactory> logger,
225 Api.Models.Instance instance)
226 {
227 this.processExecutor = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
228 this.engineManager = engineManager ?? throw new ArgumentNullException(nameof(engineManager));
229 this.topicClientFactory = topicClientFactory ?? throw new ArgumentNullException(nameof(topicClientFactory));
230 this.cryptographySuite = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
231 this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
232 this.gameIOManager = gameIOManager ?? throw new ArgumentNullException(nameof(gameIOManager));
233 this.diagnosticsIOManager = diagnosticsIOManager ?? throw new ArgumentNullException(nameof(diagnosticsIOManager));
234 this.chat = chat ?? throw new ArgumentNullException(nameof(chat));
235 this.networkPromptReaper = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
236 this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
237 this.bridgeRegistrar = bridgeRegistrar ?? throw new ArgumentNullException(nameof(bridgeRegistrar));
238 this.serverPortProvider = serverPortProvider ?? throw new ArgumentNullException(nameof(serverPortProvider));
239 this.eventConsumer = eventConsumer ?? throw new ArgumentNullException(nameof(eventConsumer));
240 this.asyncDelayer = asyncDelayer ?? throw new ArgumentNullException(nameof(asyncDelayer));
241 this.dotnetDumpService = dotnetDumpService ?? throw new ArgumentNullException(nameof(dotnetDumpService));
242 ArgumentNullException.ThrowIfNull(metricFactory);
243 this.sessionConfigurationOptions = sessionConfigurationOptions ?? throw new ArgumentNullException(nameof(sessionConfigurationOptions));
244 this.loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
245 this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
246 this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
247
248 sessionsLaunched = metricFactory.CreateCounter("tgs_sessions_launched", "The number of game server processes created");
249 lastSessionLaunch = metricFactory.CreateGauge("tgs_session_start_time", "The UTC unix timestamp the most recent session was started");
250 }
251
253 #pragma warning disable CA1506 // TODO: Decomplexify
254 public async ValueTask<ISessionController> LaunchNew(
255 IDmbProvider dmbProvider,
256 IEngineExecutableLock? currentByondLock,
257 DreamDaemonLaunchParameters launchParameters,
258 bool apiValidate,
259 CancellationToken cancellationToken)
260 {
261 logger.LogTrace("Begin session launch...");
262 if (!launchParameters.Port.HasValue)
263 throw new InvalidOperationException("Given port is null!");
264
265 switch (dmbProvider.CompileJob.MinimumSecurityLevel)
266 {
267 case DreamDaemonSecurity.Ultrasafe:
268 break;
269 case DreamDaemonSecurity.Safe:
270 if (launchParameters.SecurityLevel == DreamDaemonSecurity.Ultrasafe)
271 {
272 logger.LogTrace("Boosting security level to minimum of Safe");
273 launchParameters.SecurityLevel = DreamDaemonSecurity.Safe;
274 }
275
276 break;
277 case DreamDaemonSecurity.Trusted:
278 if (launchParameters.SecurityLevel != DreamDaemonSecurity.Trusted)
279 logger.LogTrace("Boosting security level to minimum of Trusted");
280
281 launchParameters.SecurityLevel = DreamDaemonSecurity.Trusted;
282 break;
283 default:
284 throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Invalid DreamDaemonSecurity value: {0}", dmbProvider.CompileJob.MinimumSecurityLevel));
285 }
286
287 // get the byond lock
288 var engineLock = currentByondLock ?? await engineManager.UseExecutables(
289 dmbProvider.EngineVersion,
290 gameIOManager.ConcatPath(dmbProvider.Directory, dmbProvider.DmbName),
291 cancellationToken);
292 try
293 {
294 logger.LogDebug(
295 "Launching session with CompileJob {compileJobId}...",
296 dmbProvider.CompileJob.Id);
297
298 // mad this isn't abstracted but whatever
299 var engineType = dmbProvider.EngineVersion.Engine!.Value;
300 if (engineType == EngineType.Byond)
302
303 await PortBindTest(launchParameters.Port.Value, engineType, cancellationToken);
304
305 string? outputFilePath = null;
306 var preserveLogFile = true;
307
308 var hasStandardOutput = engineLock.HasStandardOutput;
309 if (launchParameters.LogOutput!.Value)
310 {
311 var now = DateTimeOffset.UtcNow;
312 var dateDirectory = diagnosticsIOManager.ConcatPath(DreamDaemonLogsPath, now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
313 await diagnosticsIOManager.CreateDirectory(dateDirectory, cancellationToken);
314 outputFilePath = diagnosticsIOManager.ResolvePath(
316 dateDirectory,
317 $"server-utc-{now.ToString("yyyy-MM-dd-HH-mm-ss", CultureInfo.InvariantCulture)}{(apiValidate ? "-dmapi" : String.Empty)}.log"));
318
319 logger.LogInformation("Logging server output to {path}...", outputFilePath);
320 }
321 else if (!hasStandardOutput)
322 {
323 outputFilePath = gameIOManager.ConcatPath(dmbProvider.Directory, $"{Guid.NewGuid()}.server.log");
324 preserveLogFile = false;
325 }
326
327 var accessIdentifier = cryptographySuite.GetSecureString();
328
329 if (!apiValidate && dmbProvider.CompileJob.DMApiVersion == null)
330 logger.LogDebug("Session will have no DMAPI support!");
331
332 // launch dd
333 var process = await CreateGameServerProcess(
334 dmbProvider,
335 engineLock,
336 launchParameters,
337 accessIdentifier,
338 outputFilePath,
339 apiValidate,
340 cancellationToken);
341
342 try
343 {
344 var chatTrackingContext = chat.CreateTrackingContext();
345
346 try
347 {
348 var runtimeInformation = CreateRuntimeInformation(
349 dmbProvider,
350 chatTrackingContext,
351 launchParameters.SecurityLevel!.Value,
352 launchParameters.Visibility!.Value,
353 apiValidate);
354
355 var reattachInformation = new ReattachInformation(
356 dmbProvider,
357 process,
358 runtimeInformation,
359 accessIdentifier,
360 launchParameters.Port.Value);
361
362 var byondTopicSender = topicClientFactory.CreateTopicClient(
363 TimeSpan.FromMilliseconds(
364 launchParameters.TopicRequestTimeout!.Value));
365
366 var sessionController = new SessionController(
367 reattachInformation,
368 instance,
369 process,
370 engineLock,
371 byondTopicSender,
372 chatTrackingContext,
374 chat,
379 loggerFactory.CreateLogger<SessionController>(),
380 () => LogDDOutput(
381 process,
382 outputFilePath,
383 hasStandardOutput,
384 preserveLogFile,
385 CancellationToken.None), // DCT: None available
386 launchParameters.StartupTimeout,
387 false,
388 apiValidate);
389
390 if (!apiValidate)
391 {
392 sessionsLaunched.Inc();
393 lastSessionLaunch.SetToCurrentTimeUtc();
394 }
395
396 return sessionController;
397 }
398 catch
399 {
400 chatTrackingContext.Dispose();
401 throw;
402 }
403 }
404 catch
405 {
406 await using (process)
407 {
408 process.Terminate();
409 await process.Lifetime;
410 throw;
411 }
412 }
413 }
414 catch
415 {
416 if (currentByondLock == null)
417 engineLock.Dispose();
418 throw;
419 }
420 }
421#pragma warning restore CA1506
422
424 public async ValueTask<ISessionController?> Reattach(
425 ReattachInformation reattachInformation,
426 CancellationToken cancellationToken)
427 {
428 ArgumentNullException.ThrowIfNull(reattachInformation);
429
430 logger.LogTrace("Begin session reattach...");
431 var byondTopicSender = topicClientFactory.CreateTopicClient(reattachInformation.TopicRequestTimeout);
432 var engineLock = await engineManager.UseExecutables(
433 reattachInformation.Dmb.EngineVersion,
434 null, // Doesn't matter if it's trusted or not on reattach
435 cancellationToken);
436
437 try
438 {
439 logger.LogDebug(
440 "Attaching to session PID: {pid}, CompileJob: {compileJobId}...",
441 reattachInformation.ProcessId,
442 reattachInformation.Dmb.CompileJob.Id);
443
444 var process = processExecutor.GetProcess(reattachInformation.ProcessId);
445 if (process == null)
446 return null;
447
448 try
449 {
450 if (engineLock.PromptsForNetworkAccess)
452
453 var chatTrackingContext = chat.CreateTrackingContext();
454 try
455 {
456 var runtimeInformation = CreateRuntimeInformation(
457 reattachInformation.Dmb,
458 chatTrackingContext,
459 reattachInformation.LaunchSecurityLevel,
460 reattachInformation.LaunchVisibility,
461 false);
462 reattachInformation.SetRuntimeInformation(runtimeInformation);
463
464 var controller = new SessionController(
465 reattachInformation,
466 instance,
467 process,
468 engineLock,
469 byondTopicSender,
470 chatTrackingContext,
472 chat,
477 loggerFactory.CreateLogger<SessionController>(),
478 () => ValueTask.CompletedTask,
479 null,
480 true,
481 false);
482
483 process = null;
484 engineLock = null;
485 chatTrackingContext = null;
486
487 return controller;
488 }
489 catch
490 {
491 chatTrackingContext?.Dispose();
492 throw;
493 }
494 }
495 catch
496 {
497 if (process != null)
498 await process.DisposeAsync();
499
500 throw;
501 }
502 }
503 catch
504 {
505 engineLock?.Dispose();
506 throw;
507 }
508 }
509
521 async ValueTask<IProcess> CreateGameServerProcess(
522 IDmbProvider dmbProvider,
523 IEngineExecutableLock engineLock,
524 DreamDaemonLaunchParameters launchParameters,
525 string accessIdentifier,
526 string? logFilePath,
527 bool apiValidate,
528 CancellationToken cancellationToken)
529 {
530 var serverMayHaveDMApi = apiValidate || dmbProvider.CompileJob.DMApiVersion != null;
531
532 var serverArguments = serverMayHaveDMApi
533 ? new Dictionary<string, string>
534 {
536 { DMApiConstants.ParamServerPort, serverPortProvider.HttpApiPort.ToString(CultureInfo.InvariantCulture) },
537 { DMApiConstants.ParamAccessIdentifier, accessIdentifier },
538 }
539 : null;
540
541 var environment = await engineLock.LoadEnv(logger, false, cancellationToken);
542 var arguments = engineLock.FormatServerArguments(
543 dmbProvider,
544 serverArguments,
545 launchParameters,
546 accessIdentifier,
547 !engineLock.HasStandardOutput || engineLock.PreferFileLogging
548 ? logFilePath
549 : null);
550
551 // If this isnt a staging DD (From a Deployment), fire off events
552 if (!apiValidate)
554 EventType.DreamDaemonPreLaunch,
555 Enumerable.Empty<string?>(),
556 false,
557 cancellationToken);
558
559 var process = await processExecutor.LaunchProcess(
560 engineLock.ServerExePath,
561 dmbProvider.Directory,
562 arguments,
563 cancellationToken,
564 environment,
565 logFilePath,
566 engineLock.HasStandardOutput,
567 true);
568
569 try
570 {
571 var sessionConfiguration = sessionConfigurationOptions.CurrentValue;
572 if (!apiValidate)
573 {
574 if (sessionConfiguration.HighPriorityLiveDreamDaemon)
575 process.AdjustPriority(true);
576 }
577 else if (sessionConfiguration.LowPriorityDeploymentProcesses)
578 process.AdjustPriority(false);
579
580 if (!engineLock.HasStandardOutput)
582
583 if (!apiValidate)
585 EventType.DreamDaemonLaunch,
586 new List<string>
587 {
588 process.Id.ToString(CultureInfo.InvariantCulture),
589 },
590 false,
591 cancellationToken);
592
593 return process;
594 }
595 catch
596 {
597 await using (process)
598 {
599 process.Terminate();
600 await process.Lifetime;
601 throw;
602 }
603 }
604 }
605
615 async ValueTask LogDDOutput(IProcess process, string? outputFilePath, bool cliSupported, bool preserveFile, CancellationToken cancellationToken)
616 {
617 try
618 {
619 string? ddOutput = null;
620 if (cliSupported)
621 ddOutput = (await process.GetCombinedOutput(cancellationToken))!;
622
623 if (String.IsNullOrWhiteSpace(ddOutput) && outputFilePath != null)
624 try
625 {
626 var dreamDaemonLogBytes = await gameIOManager.ReadAllBytes(
627 outputFilePath,
628 cancellationToken);
629
630 ddOutput = Encoding.UTF8.GetString(dreamDaemonLogBytes);
631 }
632 finally
633 {
634 if (!preserveFile)
635 try
636 {
637 logger.LogTrace("Deleting temporary log file {path}...", outputFilePath);
638 await gameIOManager.DeleteFile(outputFilePath, cancellationToken);
639 }
640 catch (Exception ex)
641 {
642 // this is expected on OD at time of the support changes.
643 // I've open a change to fix it: https://github.com/space-wizards/RobustToolbox/pull/4501
644 logger.LogWarning(ex, "Failed to delete server log file {outputFilePath}!", outputFilePath);
645 }
646 }
647
648 logger.LogTrace(
649 "Server Output:{newLine}{output}",
650 Environment.NewLine,
651 ddOutput);
652 }
653 catch (Exception ex)
654 {
655 logger.LogWarning(ex, "Error reading server output!");
656 }
657 }
658
669 IDmbProvider dmbProvider,
670 IChatTrackingContext chatTrackingContext,
671 DreamDaemonSecurity securityLevel,
672 DreamDaemonVisibility visibility,
673 bool apiValidateOnly)
674 => new(
675 chatTrackingContext,
676 dmbProvider,
677 assemblyInformationProvider.Version,
678 instance.Name!,
679 securityLevel,
680 visibility,
681 serverPortProvider.HttpApiPort,
682 apiValidateOnly);
683
688 async ValueTask CheckPagerIsNotRunning()
689 {
690 if (!platformIdentifier.IsWindows)
691 return;
692
693 await using var otherProcess = processExecutor.GetProcessByName("byond");
694 if (otherProcess == null)
695 return;
696
697 var otherUsername = otherProcess.GetExecutingUsername();
698
699 await using var ourProcess = processExecutor.GetCurrentProcess();
700 var ourUsername = ourProcess.GetExecutingUsername();
701
702 if (otherUsername.Equals(ourUsername, StringComparison.Ordinal))
703 throw new JobException(ErrorCode.DreamDaemonPagerRunning);
704 }
705 }
706}
virtual ? long Id
The ID of the entity.
Definition EntityId.cs:14
Metadata about a server instance.
Definition Instance.cs:9
virtual ? Version DMApiVersion
The DMAPI Version.
Definition CompileJob.cs:43
DreamDaemonSecurity? MinimumSecurityLevel
The minimum DreamDaemonSecurity required to run the CompileJob's output.
Definition CompileJob.cs:35
ushort? Port
The port DreamDaemon uses. This should be publically accessible.
DreamDaemonVisibility? Visibility
The DreamDaemonVisibility level of DreamDaemon. No-op for EngineType.OpenDream.
bool? LogOutput
If process output/error text should be logged.
uint? TopicRequestTimeout
The timeout for sending and receiving BYOND topics in milliseconds.
DreamDaemonSecurity? SecurityLevel
The DreamDaemonSecurity level of DreamDaemon. No-op for EngineType.OpenDream.
Representation of the initial data passed as part of a BridgeCommandType.Startup request.
Constants used for communication with the DMAPI.
const string ParamServerPort
Identifies the Core.IServerPortProvider.HttpApiPort of the server.
const string ParamAccessIdentifier
Identifies the DMApiParameters.AccessIdentifier for the session.
const string ParamApiVersion
Identifies a DMAPI execution with the version as the value.
static readonly Version InteropVersion
The DMAPI InteropVersion being used.
Parameters necessary for duplicating a ISessionController session.
TimeSpan TopicRequestTimeout
The TimeSpan which indicates when topic requests should timeout.
void SetRuntimeInformation(RuntimeInformation runtimeInformation)
Set the RuntimeInformation post construction.
IDmbProvider Dmb
The IDmbProvider used by DreamDaemon.
readonly IEventConsumer eventConsumer
The IEventConsumer for the SessionControllerFactory.
readonly ITopicClientFactory topicClientFactory
The ITopicClientFactory for the SessionControllerFactory.
readonly IServerPortProvider serverPortProvider
The IServerPortProvider for the SessionControllerFactory.
readonly ILoggerFactory loggerFactory
The ILoggerFactory for the SessionControllerFactory.
readonly IProcessExecutor processExecutor
The IProcessExecutor for the SessionControllerFactory.
readonly IIOManager gameIOManager
The IIOManager for the Game directory.
async ValueTask CheckPagerIsNotRunning()
Make sure the BYOND pager is not running.
readonly IPlatformIdentifier platformIdentifier
The IPlatformIdentifier for the SessionControllerFactory.
async ValueTask LogDDOutput(IProcess process, string? outputFilePath, bool cliSupported, bool preserveFile, CancellationToken cancellationToken)
Attempts to log DreamDaemon output.
RuntimeInformation CreateRuntimeInformation(IDmbProvider dmbProvider, IChatTrackingContext chatTrackingContext, DreamDaemonSecurity securityLevel, DreamDaemonVisibility visibility, bool apiValidateOnly)
Create RuntimeInformation.
readonly ICryptographySuite cryptographySuite
The ICryptographySuite for the SessionControllerFactory.
async ValueTask< IProcess > CreateGameServerProcess(IDmbProvider dmbProvider, IEngineExecutableLock engineLock, DreamDaemonLaunchParameters launchParameters, string accessIdentifier, string? logFilePath, bool apiValidate, CancellationToken cancellationToken)
Creates the game server IProcess.
readonly IBridgeRegistrar bridgeRegistrar
The IBridgeRegistrar for the SessionControllerFactory.
async ValueTask PortBindTest(ushort port, EngineType engineType, CancellationToken cancellationToken)
Check if a given port can be bound to.
const string DreamDaemonLogsPath
Path in Diagnostics folder to DreamDaemon logs.
readonly Counter sessionsLaunched
The number of sessions launched.
readonly Api.Models.Instance instance
The Api.Models.Instance for the SessionControllerFactory.
readonly INetworkPromptReaper networkPromptReaper
The INetworkPromptReaper for the SessionControllerFactory.
readonly ILogger< SessionControllerFactory > logger
The ILogger for the SessionControllerFactory.
readonly IChatManager chat
The IChatManager for the SessionControllerFactory.
readonly IAssemblyInformationProvider assemblyInformationProvider
The IAssemblyInformationProvider for the SessionControllerFactory.
async ValueTask< ISessionController > LaunchNew(IDmbProvider dmbProvider, IEngineExecutableLock? currentByondLock, DreamDaemonLaunchParameters launchParameters, bool apiValidate, CancellationToken cancellationToken)
Create a ISessionController from a freshly launch DreamDaemon instance.A ValueTask<TResult> resulting...
readonly IDotnetDumpService dotnetDumpService
The IDotnetDumpService for the SessionControllerFactory.
readonly IEngineManager engineManager
The IEngineManager for the SessionControllerFactory.
SessionControllerFactory(IProcessExecutor processExecutor, IEngineManager engineManager, ITopicClientFactory topicClientFactory, ICryptographySuite cryptographySuite, IAssemblyInformationProvider assemblyInformationProvider, IIOManager gameIOManager, IIOManager diagnosticsIOManager, IChatManager chat, INetworkPromptReaper networkPromptReaper, IPlatformIdentifier platformIdentifier, IBridgeRegistrar bridgeRegistrar, IServerPortProvider serverPortProvider, IEventConsumer eventConsumer, IAsyncDelayer asyncDelayer, IDotnetDumpService dotnetDumpService, IMetricFactory metricFactory, ILoggerFactory loggerFactory, IOptionsMonitor< SessionConfiguration > sessionConfigurationOptions, ILogger< SessionControllerFactory > logger, Api.Models.Instance instance)
Initializes a new instance of the SessionControllerFactory class.
async ValueTask< ISessionController?> Reattach(ReattachInformation reattachInformation, CancellationToken cancellationToken)
Create a ISessionController from an existing DreamDaemon instance.A ValueTask<TResult> resulting in a...
readonly Gauge lastSessionLaunch
The time the current session was launched.
readonly IAsyncDelayer asyncDelayer
The IAsyncDelayer for the SessionControllerFactory.
readonly IOptionsMonitor< SessionConfiguration > sessionConfigurationOptions
The IOptionsMonitor<TOptions> of SessionConfiguration for the SessionControllerFactory.
readonly IIOManager diagnosticsIOManager
The IIOManager for the Diagnostics directory.
Extension methods for the Socket class.
static void BindTest(IPlatformIdentifier platformIdentifier, ushort port, bool includeIPv6, bool udp)
Attempt to exclusively bind to a given port .
Operation exceptions thrown from the context of a Models.Job.
DreamDaemonSecurity LaunchSecurityLevel
The DreamDaemonSecurity level DreamDaemon was launched with.
DreamDaemonVisibility LaunchVisibility
The DreamDaemonVisibility DreamDaemon was launched with.
For managing connected chat services.
IChatTrackingContext CreateTrackingContext()
Start tracking Commands.CustomCommands and ChannelRepresentations.
Represents a tracking of dynamic chat json files.
Provides absolute paths to the latest compiled .dmbs.
EngineVersion EngineVersion
The Api.Models.EngineVersion used to build the .dmb.
Models.CompileJob CompileJob
The CompileJob of the .dmb.
Represents usage of the two primary BYOND server executables.
string ServerExePath
The full path to the game server executable.
string FormatServerArguments(IDmbProvider dmbProvider, IReadOnlyDictionary< string, string >? parameters, DreamDaemonLaunchParameters launchParameters, string accessIdentifier, string? logFilePath)
Return the command line arguments for launching with given launchParameters .
ValueTask< Dictionary< string, string >?> LoadEnv(ILogger logger, bool forCompiler, CancellationToken cancellationToken)
Loads the environment settings for either the server or compiler.
bool PreferFileLogging
If HasStandardOutput is set, this indicates that the engine server has good file logging that should ...
bool HasStandardOutput
If ServerExePath supports being run as a command-line application and outputs log information to be c...
ValueTask< IEngineExecutableLock > UseExecutables(EngineVersion? requiredVersion, string? trustDmbFullPath, CancellationToken cancellationToken)
Lock the current installation's location and return a IEngineExecutableLock.
Consumes EventTypes and takes the appropriate actions.
ValueTask HandleEvent(EventType eventType, IEnumerable< string?> parameters, bool deploymentPipeline, CancellationToken cancellationToken)
Handle a given eventType .
ITopicClient CreateTopicClient(TimeSpan timeout)
Create a ITopicClient.
Provides access to the server's HttpApiPort.
ushort HttpApiPort
The port the server listens on.
Interface for using filesystems.
Definition IIOManager.cs:14
string ResolvePath()
Retrieve the full path of the current working directory.
string ConcatPath(params string[] paths)
Combines an array of strings into a path.
Task CreateDirectory(string path, CancellationToken cancellationToken)
Create a directory at path .
Contains various cryptographic functions.
string GetSecureString()
Generates a 40-length secure ascii string.
Service for managing the dotnet-dump installation.
On Windows, DreamDaemon will show an unskippable prompt when using /world/proc/OpenPort()....
void RegisterProcess(IProcess process)
Register a given process for network prompt reaping.
For identifying the current platform.
bool IsWindows
If the current platform is a Windows platform.
ValueTask< IProcess > LaunchProcess(string fileName, string workingDirectory, string arguments, CancellationToken cancellationToken, IReadOnlyDictionary< string, string >? environment=null, string? fileRedirect=null, bool readStandardHandles=false, bool noShellExecute=false)
Launch a IProcess.
IProcess? GetProcess(int id)
Get a IProcess by id .
Abstraction over a global::System.Diagnostics.Process.
Definition IProcess.cs:11
Task< string?> GetCombinedOutput(CancellationToken cancellationToken)
Get the stderr and stdout output of the IProcess.
ValueTask Delay(TimeSpan timeSpan, CancellationToken cancellationToken)
Create a Task that completes after a given timeSpan .
ErrorCode
Types of Response.ErrorMessageResponses that the API may return.
Definition ErrorCode.cs:12
DreamDaemonVisibility
The visibility setting for DreamDaemon.
DreamDaemonSecurity
DreamDaemon's security level.
EngineType
The type of engine the codebase is using.
Definition EngineType.cs:7
EventType
Types of events. Mirror in tgs.dm. Prefer last listed name for script.
Definition EventType.cs:7