aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mangosd/Master.cpp130
-rw-r--r--src/shared/revision_nr.h2
2 files changed, 67 insertions, 65 deletions
diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp
index f175d4d82b0..23acf37be30 100644
--- a/src/mangosd/Master.cpp
+++ b/src/mangosd/Master.cpp
@@ -118,72 +118,74 @@ public:
class RARunnable : public ZThread::Runnable
{
public:
- uint32 numLoops, loopCounter;
-
- RARunnable ()
- {
- uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
- numLoops = (sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000000 / socketSelecttime));
- loopCounter = 0;
- }
-
- void
- checkping ()
- {
- // ping if need
- if ((++loopCounter) == numLoops)
- {
+ uint32 numLoops, loopCounter;
+
+ RARunnable ()
+ {
+ uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
+ numLoops = (sConfig.GetIntDefault ("MaxPingTime", 30) * (MINUTE * 1000000 / socketSelecttime));
loopCounter = 0;
- sLog.outDetail ("Ping MySQL to keep connection alive");
- delete WorldDatabase.Query ("SELECT 1 FROM command LIMIT 1");
- delete LoginDatabase.Query ("SELECT 1 FROM realmlist LIMIT 1");
- delete CharacterDatabase.Query ("SELECT 1 FROM bugreport LIMIT 1");
- }
- }
-
- void
- run (void)
- {
- SocketHandler h;
-
- // Launch the RA listener socket
- ListenSocket<RASocket> RAListenSocket (h);
- bool usera = sConfig.GetBoolDefault ("Ra.Enable", false);
-
- if (usera)
- {
- port_t raport = sConfig.GetIntDefault ("Ra.Port", 3443);
- std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0");
- ipaddr_t raip;
- if (!Utility::u2ip (stringip, raip))
- sLog.outError ("Trinity RA can not bind to ip %s", stringip.c_str ());
- else if (RAListenSocket.Bind (raip, raport))
- sLog.outError ("Trinity RA can not bind to port %d on %s", raport, stringip.c_str ());
- else
- {
- h.Add (&RAListenSocket);
+ }
+
+ void checkping ()
+ {
+ // ping if need
+ if ((++loopCounter) == numLoops)
+ {
+ loopCounter = 0;
+ sLog.outDetail ("Ping MySQL to keep connection alive");
+ delete WorldDatabase.Query ("SELECT 1 FROM command LIMIT 1");
+ delete loginDatabase.Query ("SELECT 1 FROM realmlist LIMIT 1");
+ delete CharacterDatabase.Query ("SELECT 1 FROM bugreport LIMIT 1");
+ }
+ }
+
+ void run ()
+ {
+ SocketHandler h;
+
+ // Launch the RA listener socket
+ ListenSocket<RASocket> RAListenSocket (h);
+ bool usera = sConfig.GetBoolDefault ("Ra.Enable", false);
- sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ());
- }
- }
+ if (usera)
+ {
+ port_t raport = sConfig.GetIntDefault ("Ra.Port", 3443);
+ std::string stringip = sConfig.GetStringDefault ("Ra.IP", "0.0.0.0");
+ ipaddr_t raip;
+ if (!Utility::u2ip (stringip, raip))
+ sLog.outError ("MaNGOS RA can not bind to ip %s", stringip.c_str ());
+ else if (RAListenSocket.Bind (raip, raport))
+ sLog.outError ("MaNGOS RA can not bind to port %d on %s", raport, stringip.c_str ());
+ else
+ {
+ h.Add (&RAListenSocket);
+
+ sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ());
+ }
+ }
- // Socket Selet time is in microseconds , not miliseconds!!
- uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
+ // Socket Selet time is in microseconds , not miliseconds!!
+ uint32 socketSelecttime = sWorld.getConfig (CONFIG_SOCKET_SELECTTIME);
- // if use ra spend time waiting for io, if not use ra ,just sleep
- if (usera)
- while (!World::IsStopped())
+ // if use ra spend time waiting for io, if not use ra ,just sleep
+ if (usera)
{
- h.Select (0, socketSelecttime);
- checkping ();
+ while (!World::IsStopped())
+ {
+ h.Select (0, socketSelecttime);
+ checkping ();
+ }
}
- else
- while (!World::IsStopped())
+ else
{
- ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000));
- checkping ();
+ while (!World::IsStopped())
+ {
+ ZThread::Thread::sleep (static_cast<unsigned long> (socketSelecttime / 1000));
+ checkping ();
+ }
}
- }
+ }
};
Master::Master()
@@ -317,14 +319,14 @@ int Master::Run()
}
///- Launch the world listener socket
- port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
- std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
+ port_t wsport = sWorld.getConfig (CONFIG_PORT_WORLD);
+ std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
- if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
+ if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
{
- sLog.outError ("Failed to start network");
- World::StopNow(ERROR_EXIT_CODE);
- // go down and shutdown the server
+ sLog.outError ("Failed to start network");
+ World::StopNow(ERROR_EXIT_CODE);
+ // go down and shutdown the server
}
sWorldSocketMgr->Wait ();
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index ef6ad92ed9a..8e527cfed75 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "7269"
+ #define REVISION_NR "7270"
#endif // __REVISION_NR_H__