Properly exit

Properly exit based on the path taken to shutdown master.

Tested that shutting down through sigint or sigterm returns -1
Tested that a segfault exits the program properly
Need to test that players who are trying to connect while master is shutting down are not able to spawn more child worlds.
This commit is contained in:
EmosewaMC
2022-12-15 05:46:03 -08:00
parent 435761f64b
commit 1afe717563
7 changed files with 65 additions and 31 deletions

View File

@@ -36,7 +36,7 @@ public:
}
} ReceiveDownloadCompleteCB;
dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnections, bool isInternal, bool useEncryption, dLogger* logger, const std::string masterIP, int masterPort, ServerType serverType, dConfig* config, bool& shouldShutdown, unsigned int zoneID) {
dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnections, bool isInternal, bool useEncryption, dLogger* logger, const std::string masterIP, int masterPort, ServerType serverType, dConfig* config, bool* shouldShutdown, unsigned int zoneID) {
mIP = ip;
mPort = port;
mZoneID = zoneID;
@@ -52,7 +52,7 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect
mReplicaManager = nullptr;
mServerType = serverType;
mConfig = config;
mShouldShutdown = &shouldShutdown;
mShouldShutdown = shouldShutdown;
//Attempt to start our server here:
mIsOkay = Startup();

View File

@@ -30,7 +30,7 @@ public:
int masterPort,
ServerType serverType,
dConfig* config,
bool& shouldShutdown,
bool* shouldShutdown,
unsigned int zoneID = 0);
~dServer();