fix: signal handling (#1375)

* fix: signal handling

* fix: flush WorldServer logger before main loop

* fix: consolidate signal code
This commit is contained in:
Daniel Seiler
2024-01-02 04:50:00 +01:00
committed by GitHub
parent 18feea5fed
commit 85672e060a
13 changed files with 92 additions and 45 deletions

View File

@@ -2,6 +2,7 @@
#include <string>
#include <random>
#include <csignal>
class dServer;
class Logger;
@@ -16,6 +17,7 @@ class dZoneManager;
class PlayerContainer;
namespace Game {
using signal_t = volatile std::sig_atomic_t;
extern Logger* logger;
extern dServer* server;
extern InstanceManager* im;
@@ -25,9 +27,14 @@ namespace Game {
extern RakPeerInterface* chatServer;
extern AssetManager* assetManager;
extern SystemAddress chatSysAddr;
extern bool shouldShutdown;
extern signal_t lastSignal;
extern EntityManager* entityManager;
extern dZoneManager* zoneManager;
extern PlayerContainer playerContainer;
extern std::string projectVersion;
inline bool ShouldShutdown() {
return lastSignal != 0;
}
void OnSignal(int signal);
}