mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Rewrite remote access console using ACE
--HG-- branch : trunk
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
#include "CliRunnable.h"
|
||||
#include "Log.h"
|
||||
#include "Master.h"
|
||||
#include "RASocket.h"
|
||||
#include "RARunnable.h"
|
||||
#include "TCSoap.h"
|
||||
#include "Timer.h"
|
||||
#include "Util.h"
|
||||
@@ -114,53 +114,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class RARunnable : public ACE_Based::Runnable
|
||||
{
|
||||
public:
|
||||
RARunnable () {}
|
||||
|
||||
void run ()
|
||||
{
|
||||
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);
|
||||
|
||||
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.getIntConfig(CONFIG_SOCKET_SELECTTIME);
|
||||
|
||||
// if use ra spend time waiting for io, if not use ra ,just sleep
|
||||
if (usera)
|
||||
{
|
||||
while (!World::IsStopped())
|
||||
h.Select (0, socketSelecttime);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!World::IsStopped())
|
||||
ACE_Based::Thread::Sleep(static_cast<unsigned long> (socketSelecttime / 1000));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Master::Master()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user