From ca39f783b9f80fd7a657739e840597a7fe3d2e82 Mon Sep 17 00:00:00 2001
From: Li
Date: Sat, 18 Jun 2022 00:52:51 +1200
Subject: [PATCH] add graceful exit on SIGKILL/SIGTERM
---
HorseIsleServer/HISPd/Program.cs | 7 +++++++
HorseIsleServer/HISPd/Properties/AssemblyInfo.cs | 4 ++--
HorseIsleServer/HISPd/Resources/DEBIAN/control | 2 +-
HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs | 4 ++--
HorseIsleServer/LibHISP/Server/GameServer.cs | 1 +
HorseIsleServer/N00BS/Properties/AssemblyInfo.cs | 4 ++--
6 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/HorseIsleServer/HISPd/Program.cs b/HorseIsleServer/HISPd/Program.cs
index 176ec53..2ad54de 100644
--- a/HorseIsleServer/HISPd/Program.cs
+++ b/HorseIsleServer/HISPd/Program.cs
@@ -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();
+ }
}
}
diff --git a/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs b/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
index 347d0ac..fbaa205 100644
--- a/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/HISPd/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.20.0")]
-[assembly: AssemblyFileVersion("1.7.20.0")]
+[assembly: AssemblyVersion("1.7.21.0")]
+[assembly: AssemblyFileVersion("1.7.21.0")]
diff --git a/HorseIsleServer/HISPd/Resources/DEBIAN/control b/HorseIsleServer/HISPd/Resources/DEBIAN/control
index 67cb8c8..7c6017b 100644
--- a/HorseIsleServer/HISPd/Resources/DEBIAN/control
+++ b/HorseIsleServer/HISPd/Resources/DEBIAN/control
@@ -1,5 +1,5 @@
Package: hisp
-Version: 1.7.20
+Version: 1.7.21
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li
Homepage: https://islehorse.com
diff --git a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
index 95bbc15..4f6f3a1 100644
--- a/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/LibHISP/Properties/AssemblyInfo.cs
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.7.20.0")]
-[assembly: AssemblyFileVersion("1.7.20.0")]
+[assembly: AssemblyVersion("1.7.21.0")]
+[assembly: AssemblyFileVersion("1.7.21.0")]
diff --git a/HorseIsleServer/LibHISP/Server/GameServer.cs b/HorseIsleServer/LibHISP/Server/GameServer.cs
index 2c1f3ee..3efd8fe 100644
--- a/HorseIsleServer/LibHISP/Server/GameServer.cs
+++ b/HorseIsleServer/LibHISP/Server/GameServer.cs
@@ -8258,6 +8258,7 @@ namespace HISP.Server
}
public static void ShutdownServer()
{
+ Logger.InfoPrint("Shutting down.");
GameClient.OnShutdown();
GameServer.OnShutdown();
Database.OnShutdown();
diff --git a/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs b/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs
index 7a35e92..a7c8ee0 100644
--- a/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs
+++ b/HorseIsleServer/N00BS/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.7.20.0")]
-[assembly: AssemblyFileVersion("1.7.20.0")]
+[assembly: AssemblyVersion("1.7.21.0")]
+[assembly: AssemblyFileVersion("1.7.21.0")]