tgstation-server  4.3.2
The /tg/station 13 server suite
DeadSessionController.cs
Go to the documentation of this file.
1 using System;
2 using System.Threading;
3 using System.Threading.Tasks;
6 
7 namespace Tgstation.Server.Host.Components.Session
8 {
13  {
15  public Task<LaunchResult> LaunchResult { get; }
16 
18  public bool IsPrimary => false;
19 
21  public bool TerminationWasRequested => false;
22 
24  public ApiValidationStatus ApiValidationStatus => throw new NotSupportedException();
25 
27  public IDmbProvider Dmb { get; }
28 
30  public ushort? Port => null;
31 
33  public bool ClosePortOnReboot
34  {
35  get => false;
36  set => throw new NotSupportedException();
37  }
38 
40  public RebootState RebootState => throw new NotSupportedException();
41 
43  public Task OnReboot { get; }
44 
46  public Task OnPrime { get; }
47 
49  public Task<int> Lifetime { get; }
50 
52  public Version DMApiVersion => throw new NotSupportedException();
53 
57  readonly object disposeLock;
58 
62  bool disposed;
63 
68  public DeadSessionController(IDmbProvider dmbProvider)
69  {
70  Dmb = dmbProvider ?? throw new ArgumentNullException(nameof(dmbProvider));
71  LaunchResult = Task.FromResult(new LaunchResult
72  {
73  StartupTime = TimeSpan.FromSeconds(0)
74  });
75  Lifetime = Task.FromResult(-1);
76  OnReboot = Extensions.TaskExtensions.InfiniteTask();
77  OnPrime = Extensions.TaskExtensions.InfiniteTask();
78  disposeLock = new object();
79  }
80 
82  public void Dispose()
83  {
84  lock (disposeLock)
85  {
86  if (disposed)
87  return;
88  disposed = true;
89  }
90 
91  Dmb.Dispose();
92  }
93 
95  public void EnableCustomChatCommands() => throw new NotSupportedException();
96 
98  public ReattachInformation Release() => throw new NotSupportedException();
99 
101  public void ResetRebootState() => throw new NotSupportedException();
102 
104  public Task<CombinedTopicResponse> SendCommand(TopicParameters parameters, CancellationToken cancellationToken) => throw new NotSupportedException();
105 
107  public void SetHighPriority() => throw new NotSupportedException();
108 
110  public Task<bool> SetPort(ushort newPort, CancellationToken cancellatonToken) => throw new NotSupportedException();
111 
113  public Task<bool> SetRebootState(RebootState newRebootState, CancellationToken cancellationToken) => throw new NotSupportedException();
114 
116  public void ReplaceDmbProvider(IDmbProvider newProvider) => throw new NotSupportedException();
117 
119  public void Suspend() => throw new NotSupportedException();
120 
122  public void Resume() => throw new NotSupportedException();
123 
125  public Task InstanceRenamed(string newInstanceName, CancellationToken cancellationToken) => Task.CompletedTask;
126  }
127 }
ApiValidationStatus
Status of DMAPI validation
Parameters necessary for duplicating a ISessionController session
Represents the result of trying to start a DD process
Definition: LaunchResult.cs:9
RebootState
Represents the action to take when /world/Reboot() is called
Definition: RebootState.cs:6
bool disposed
If the DeadSessionController was Disposed
DeadSessionController(IDmbProvider dmbProvider)
Construct a DeadSessionController
Handles communication with a DreamDaemon IProcess
Provides absolute paths to the latest compiled .dmbs
Definition: IDmbProvider.cs:9