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