summaryrefslogtreecommitdiff
path: root/src/game-server/main-game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server/main-game.cpp')
-rw-r--r--src/game-server/main-game.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 63e1f66e..b33c4016 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -97,6 +97,12 @@ AccountConnection *accountHandler;
/** Global game state */
State *gameState;
+/** Callback used when SIGQUIT signal is received. */
+void closeGracefully(int dummy)
+{
+ running = false;
+}
+
/**
* Initializes the server.
*/
@@ -105,6 +111,10 @@ void initialize()
// Reset to default segmentation fault handling for debugging purposes
signal(SIGSEGV, SIG_DFL);
+ // Used to close via process signals
+ signal(SIGQUIT, closeGracefully);
+ signal(SIGINT, closeGracefully);
+
/*
* If the path values aren't defined, we set the default
* depending on the platform.