add graceful exit on SIGKILL/SIGTERM

This commit is contained in:
Li 2022-06-18 00:52:51 +12:00
parent e42b0bf782
commit ca39f783b9
6 changed files with 15 additions and 7 deletions

View file

@ -62,6 +62,8 @@ namespace HISP.Cli
public static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += ProcessQuitHandler;
string BaseDir = Directory.GetCurrentDirectory();
Logger.SetCallback(LogStdout);
@ -132,5 +134,10 @@ namespace HISP.Cli
shutdownHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
shutdownHandle.WaitOne();
}
private static void ProcessQuitHandler(object sender, EventArgs e)
{
GameServer.ShutdownServer();
}
}
}