From d085c0cf10f22787176b0e5e3311a4eb0db05346 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 9 Apr 2022 15:35:40 -0700 Subject: [PATCH] correct exit --- dMasterServer/MasterServer.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 0876eaa6..2fbee693 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -47,6 +47,7 @@ namespace Game { bool shutdownSequenceStarted = false; void ShutdownSequence(); +int FinalizeShutdown(); dLogger* SetupLogger(); void StartAuthServer(); void StartChatServer(); @@ -168,7 +169,7 @@ int main(int argc, char** argv) { std::cout << "Account created successfully!\n"; - Database::Destroy(); + Database::Destroy("MasterServer"); delete Game::logger; return EXIT_SUCCESS; @@ -318,14 +319,8 @@ int main(int argc, char** argv) { t += std::chrono::milliseconds(highFrameRate); std::this_thread::sleep_until(t); } - - //Delete our objects here: - Database::Destroy(); - delete Game::im; - delete Game::server; - delete Game::logger; - - return EXIT_SUCCESS; + FinalizeShutdown(); + exit(0); } dLogger* SetupLogger() { @@ -787,5 +782,15 @@ void ShutdownSequence() { } } - exit(0); + FinalizeShutdown(); } + +int FinalizeShutdown() { + //Delete our objects here: + Database::Destroy("MasterServer"); + delete Game::im; + delete Game::server; + delete Game::logger; + + exit(0); +} \ No newline at end of file