From bd85914d92ccab255475dce9d4700abdc8428fb4 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Thu, 13 Jan 2011 21:30:37 +0100 Subject: Core/DBLayer: Properly manage mysql library initialization and shutdown in authserver and worldserver. Prevent multiple calls and make it more elegant. --- src/server/authserver/Main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/server/authserver/Main.cpp') diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index b3add13e9f8..29b5e508102 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -38,6 +38,7 @@ #endif bool StartDB(); +void StopDB(); bool stopEvent = false; // Setting it to true stops the server @@ -235,8 +236,8 @@ extern int main(int argc, char **argv) } } - // Close the Database Pool - LoginDatabase.Close(); + // Close the Database Pool and library + StopDB(); sLog->outString("Halting process..."); return 0; @@ -245,6 +246,8 @@ extern int main(int argc, char **argv) // Initialize connection to the database bool StartDB() { + MySQL::Library_Init(); + std::string dbstring = sConfig->GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { @@ -275,3 +278,9 @@ bool StartDB() return true; } + +void StopDB() +{ + LoginDatabase.Close(); + MySQL::Library_End(); +} \ No newline at end of file -- cgit v1.2.3