aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Main.cpp
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-01-13 21:30:37 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2011-01-13 21:30:37 +0100
commitbd85914d92ccab255475dce9d4700abdc8428fb4 (patch)
tree6d8a41fdd0678ab31977c583c4987c348f401dec /src/server/authserver/Main.cpp
parent4c15ebe09d51d22d98e314302652b66f345a56ff (diff)
Core/DBLayer: Properly manage mysql library initialization and shutdown in authserver and worldserver. Prevent multiple calls and make it more elegant.
Diffstat (limited to 'src/server/authserver/Main.cpp')
-rwxr-xr-xsrc/server/authserver/Main.cpp13
1 files changed, 11 insertions, 2 deletions
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