Merge pull request #887 from EmosewaMC/ServerShutdown

Improve server shutdown process
This commit is contained in:
Gie "Max" Vanommeslaeghe
2022-12-18 15:41:58 +01:00
committed by GitHub
8 changed files with 114 additions and 54 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, 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,6 +52,7 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect
mReplicaManager = nullptr;
mServerType = serverType;
mConfig = config;
mShouldShutdown = shouldShutdown;
//Attempt to start our server here:
mIsOkay = Startup();
@@ -124,8 +125,11 @@ Packet* dServer::ReceiveFromMaster() {
ZoneInstanceManager::Instance()->HandleRequestZoneTransferResponse(requestID, packet);
break;
}
case MSG_MASTER_SHUTDOWN:
*mShouldShutdown = true;
break;
//When we handle these packets in World instead dServer, we just return the packet's pointer.
//When we handle these packets in World instead dServer, we just return the packet's pointer.
default:
return packet;