Added the ability to kill servers which are starting / online instantly

This commit is contained in:
2025-04-15 15:33:01 +02:00
parent 37a57cb774
commit 0322b184fd

View File

@@ -45,6 +45,7 @@ public partial class Server
StateMachine.Configure(ServerState.Starting) StateMachine.Configure(ServerState.Starting)
.Permit(ServerTrigger.Stop, ServerState.Stopping) // Allow stopping .Permit(ServerTrigger.Stop, ServerState.Stopping) // Allow stopping
.Permit(ServerTrigger.Kill, ServerState.Stopping) // Allow killing while starting
.Permit(ServerTrigger.NotifyOnline, ServerState.Online) // Allow the server to report as online .Permit(ServerTrigger.NotifyOnline, ServerState.Online) // Allow the server to report as online
.Permit(ServerTrigger.NotifyRuntimeContainerDied, ServerState.Offline) // Allow server to handle container death .Permit(ServerTrigger.NotifyRuntimeContainerDied, ServerState.Offline) // Allow server to handle container death
.Permit(ServerTrigger.NotifyInternalError, ServerState.Offline) // Error handling for the action below .Permit(ServerTrigger.NotifyInternalError, ServerState.Offline) // Error handling for the action below
@@ -53,6 +54,7 @@ public partial class Server
StateMachine.Configure(ServerState.Online) StateMachine.Configure(ServerState.Online)
.Permit(ServerTrigger.Stop, ServerState.Stopping) // Allow stopping .Permit(ServerTrigger.Stop, ServerState.Stopping) // Allow stopping
.Permit(ServerTrigger.Kill, ServerState.Stopping) // Allows killing
.Permit(ServerTrigger.NotifyRuntimeContainerDied, ServerState.Offline) // Allow server to handle container death .Permit(ServerTrigger.NotifyRuntimeContainerDied, ServerState.Offline) // Allow server to handle container death
.OnExitFromAsync(ServerTrigger.NotifyRuntimeContainerDied, InternalCrash); // Define a runtime container death as a crash .OnExitFromAsync(ServerTrigger.NotifyRuntimeContainerDied, InternalCrash); // Define a runtime container death as a crash