mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-25 16:42:54 +01:00
Compare commits
2 Commits
07eed8b689
...
e40459a039
Author | SHA1 | Date | |
---|---|---|---|
e40459a039 | |||
4c66193b6e |
@ -33,6 +33,8 @@ public sealed class AgentServices {
|
||||
Logger.Information("Stopping services...");
|
||||
|
||||
await InstanceSessionManager.StopAll();
|
||||
InstanceSessionManager.Dispose();
|
||||
|
||||
await TaskManager.Stop();
|
||||
|
||||
Logger.Information("Services stopped.");
|
||||
|
@ -174,10 +174,10 @@ sealed class Instance : IDisposable {
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
stateTransitioningActionSemaphore.Dispose();
|
||||
|
||||
if (currentState is IDisposable disposable) {
|
||||
disposable.Dispose();
|
||||
}
|
||||
|
||||
stateTransitioningActionSemaphore.Dispose();
|
||||
}
|
||||
}
|
||||
|
@ -138,15 +138,24 @@ sealed class InstanceSessionManager : IDisposable {
|
||||
await semaphore.WaitAsync(CancellationToken.None);
|
||||
try {
|
||||
await Task.WhenAll(instances.Values.Select(static instance => instance.StopAndWait(TimeSpan.FromSeconds(30))));
|
||||
instances.Clear();
|
||||
DisposeAllInstances();
|
||||
} finally {
|
||||
semaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
DisposeAllInstances();
|
||||
minecraftServerExecutables.Dispose();
|
||||
shutdownCancellationTokenSource.Dispose();
|
||||
semaphore.Dispose();
|
||||
}
|
||||
|
||||
private void DisposeAllInstances() {
|
||||
foreach (var (_, instance) in instances) {
|
||||
instance.Dispose();
|
||||
}
|
||||
|
||||
instances.Clear();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Phantom.Common.Data.Instance;
|
||||
|
||||
public enum InstanceLaunchFailReason {
|
||||
public enum InstanceLaunchFailReason : byte {
|
||||
UnknownError,
|
||||
ServerPortNotAllowed,
|
||||
ServerPortAlreadyInUse,
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Phantom.Common.Data.Replies;
|
||||
|
||||
public enum LaunchInstanceResult : byte {
|
||||
UnknownError,
|
||||
LaunchInitiated,
|
||||
InstanceAlreadyLaunching,
|
||||
InstanceAlreadyRunning,
|
||||
InstanceIsStopping,
|
||||
UnknownError
|
||||
InstanceIsStopping
|
||||
}
|
||||
|
||||
public static class LaunchInstanceResultExtensions {
|
||||
|
@ -1,8 +1,8 @@
|
||||
namespace Phantom.Common.Data.Replies;
|
||||
|
||||
public enum SendCommandToInstanceResult : byte {
|
||||
Success,
|
||||
UnknownError
|
||||
UnknownError,
|
||||
Success
|
||||
}
|
||||
|
||||
public static class SendCommandToInstanceResultExtensions {
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Phantom.Common.Data.Replies;
|
||||
|
||||
public enum StopInstanceResult : byte {
|
||||
UnknownError,
|
||||
StopInitiated,
|
||||
InstanceAlreadyStopping,
|
||||
InstanceAlreadyStopped,
|
||||
UnknownError
|
||||
InstanceAlreadyStopped
|
||||
}
|
||||
|
||||
public static class StopInstanceResultExtensions {
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Phantom.Server.Services.Instances;
|
||||
|
||||
public enum AddInstanceResult {
|
||||
public enum AddInstanceResult : byte {
|
||||
UnknownError,
|
||||
Success,
|
||||
InstanceAlreadyExists,
|
||||
InstanceNameMustNotBeEmpty,
|
||||
InstanceMemoryMustNotBeZero,
|
||||
AgentNotFound,
|
||||
AgentInstanceLimitExceeded,
|
||||
AgentMemoryLimitExceeded,
|
||||
UnknownError
|
||||
AgentMemoryLimitExceeded
|
||||
}
|
||||
|
||||
public static class AddInstanceResultExtensions {
|
||||
|
Loading…
Reference in New Issue
Block a user