Core/DBLayer: Fix MySQL timeout issue. World runnable will now call KeepAlive on each database after a specified number of seconds (MaxPingTime in worldserver.conf)
Based on patch by kingarus81 Fixes issue #4062 Also remove explicit numbering from WorldTimers enum --HG-- branch : trunk
This commit is contained in:
@@ -119,25 +119,7 @@ public:
|
||||
class RARunnable : public ACE_Based::Runnable
|
||||
{
|
||||
public:
|
||||
uint32 numLoops, loopCounter;
|
||||
|
||||
RARunnable ()
|
||||
{
|
||||
uint32 socketSelecttime = sWorld.getIntConfig(CONFIG_SOCKET_SELECTTIME);
|
||||
numLoops = (sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000000 / socketSelecttime));
|
||||
loopCounter = 0;
|
||||
}
|
||||
|
||||
void checkping ()
|
||||
{
|
||||
// ping if need
|
||||
if ((++loopCounter) == numLoops)
|
||||
{
|
||||
loopCounter = 0;
|
||||
sLog.outDetail ("Ping MySQL to keep connection alive");
|
||||
LoginDatabase.KeepAlive();
|
||||
}
|
||||
}
|
||||
RARunnable () {}
|
||||
|
||||
void run ()
|
||||
{
|
||||
@@ -171,18 +153,12 @@ public:
|
||||
if (usera)
|
||||
{
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
h.Select (0, socketSelecttime);
|
||||
checkping ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
ACE_Based::Thread::Sleep(static_cast<unsigned long> (socketSelecttime / 1000));
|
||||
// checkping (); -- What?
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
# Default: 1, 1, 2
|
||||
#
|
||||
# MaxPingTime
|
||||
# Settings for maximum database-ping interval (minutes between pings)
|
||||
# Settings for maximum database-ping interval (seconds between pings)
|
||||
# Default: 1800 (30 minutes)
|
||||
#
|
||||
# WorldServerPort
|
||||
# Default WorldServerPort
|
||||
@@ -75,7 +76,7 @@ CharacterDatabase.WorkerThreads = 1
|
||||
LoginDatabase.SynchThreads = 1
|
||||
WorldDatabase.SynchThreads = 1
|
||||
CharacterDatabase.SynchThreads = 2
|
||||
MaxPingTime = 30
|
||||
MaxPingTime = 1800
|
||||
WorldServerPort = 8085
|
||||
BindIP = "0.0.0.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user