diff options
Diffstat (limited to 'src/server/authserver/Main.cpp')
-rw-r--r-- | src/server/authserver/Main.cpp | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index cd58ec2bf68..26f1c872150 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -28,6 +28,7 @@ #include "Common.h" #include "Config.h" #include "DatabaseEnv.h" +#include "DatabaseLoader.h" #include "Log.h" #include "ProcessPriority.h" #include "RealmList.h" @@ -150,33 +151,15 @@ bool StartDB() { MySQL::Library_Init(); - std::string dbstring = sConfigMgr->GetStringDefault("LoginDatabaseInfo", ""); - if (dbstring.empty()) - { - TC_LOG_ERROR("server.authserver", "Database not specified"); - return false; - } - - int32 worker_threads = sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1); - if (worker_threads < 1 || worker_threads > 32) - { - TC_LOG_ERROR("server.authserver", "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); - worker_threads = 1; - } + // Load databases + // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. + // Increasing it is just silly since only 1 will be used ever. + DatabaseLoader loader("server.authserver", DatabaseLoader::DATABASE_NONE); + loader + .AddDatabase(LoginDatabase, "Login"); - int32 synch_threads = sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1); - if (synch_threads < 1 || synch_threads > 32) - { - TC_LOG_ERROR("server.authserver", "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); - synch_threads = 1; - } - - // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. - if (!LoginDatabase.Open(dbstring, uint8(worker_threads), uint8(synch_threads))) - { - TC_LOG_ERROR("server.authserver", "Cannot connect to database"); + if (!loader.Load()) return false; - } TC_LOG_INFO("server.authserver", "Started auth database connection pool."); sLog->SetRealmId(0); // Enables DB appenders when realm is set. |