aboutsummaryrefslogtreecommitdiff
path: root/src/server/worldserver/Master.cpp
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-09-03 10:52:32 +0200
committerMachiavelli <none@none>2010-09-03 10:52:32 +0200
commit273679c5baba2c8f8978b1d5d0caadf1c933ebda (patch)
treebff84137e930a2dec85216669505aa5370f669bd /src/server/worldserver/Master.cpp
parent277f2674ac278e981bb483c13b34b0a2d2f28a2b (diff)
Core/DBLayer
- Store threadbundlemask internally per database pool and prevent direct access to config file post startup - Fix threadbundlemask flag checking for ReactorRunnable, WorldRunnable - Remove CLI threadbundlemask flag, CLI doesn´t need a seperate mysql connection nor thread - Remove unused Character Database connection from WorldSocketMgr / ReactorRunnable - Add proper LoginDatabase connection to RA Runnable (soon to be overhauled) Note: still experimental and not tested for live use --HG-- branch : trunk
Diffstat (limited to 'src/server/worldserver/Master.cpp')
-rw-r--r--src/server/worldserver/Master.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 6f964c144f2..28e0a93fd21 100644
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -33,6 +33,7 @@
#include "WorldSocketMgr.h"
#include "Configuration/Config.h"
#include "Database/DatabaseEnv.h"
+#include "Database/DatabaseWorkerPool.h"
#include "CliRunnable.h"
#include "Log.h"
@@ -134,9 +135,7 @@ public:
{
loopCounter = 0;
sLog.outDetail ("Ping MySQL to keep connection alive");
- WorldDatabase.Query ("SELECT 1 FROM command LIMIT 1");
LoginDatabase.Query ("SELECT 1 FROM realmlist LIMIT 1");
- CharacterDatabase.Query ("SELECT 1 FROM bugreport LIMIT 1");
}
}
@@ -163,6 +162,15 @@ public:
sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ());
}
+
+ bool needInit = true;
+ if ((LoginDatabase.GetBundleMask() & MYSQL_BUNDLE_RA))
+ {
+ LoginDatabase.Init_MySQL_Connection();
+ needInit = false;
+ }
+ if (needInit)
+ MySQL::Thread_Init();
}
// Socket Selet time is in microseconds , not miliseconds!!
@@ -176,13 +184,18 @@ public:
h.Select (0, socketSelecttime);
checkping ();
}
+
+ if (!needInit)
+ LoginDatabase.End_MySQL_Connection();
+ else
+ MySQL::Thread_End();
}
else
{
while (!World::IsStopped())
{
ACE_Based::Thread::Sleep(static_cast<unsigned long> (socketSelecttime / 1000));
- checkping ();
+ // checkping (); -- What?
}
}
}
@@ -440,6 +453,7 @@ bool Master::_StartDB()
sLog.SetLogDB(false);
std::string dbstring;
uint8 num_threads;
+ int32 mask;
dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", "");
if (dbstring.empty())
@@ -456,8 +470,10 @@ bool Master::_StartDB()
return false;
}
+ mask = sConfig.GetIntDefault("WorldDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL);
+
///- Initialise the world database
- if (!WorldDatabase.Open(dbstring, num_threads))
+ if (!WorldDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask)))
{
sLog.outError("Cannot connect to world database %s", dbstring.c_str());
return false;
@@ -478,12 +494,15 @@ bool Master::_StartDB()
return false;
}
+ mask = sConfig.GetIntDefault("CharacterDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL);
+
///- Initialise the Character database
- if (!CharacterDatabase.Open(dbstring, num_threads))
+ if (!CharacterDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask)))
{
sLog.outError("Cannot connect to Character database %s", dbstring.c_str());
return false;
}
+
///- Get login database info from configuration file
dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
@@ -500,8 +519,10 @@ bool Master::_StartDB()
return false;
}
+ mask = sConfig.GetIntDefault("LoginDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL);
+
///- Initialise the login database
- if (!LoginDatabase.Open(dbstring, num_threads))
+ if (!LoginDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask)))
{
sLog.outError("Cannot connect to login database %s", dbstring.c_str());
return false;