Rewrite remote access console using ACE

--HG--
branch : trunk
This commit is contained in:
Derex
2010-12-10 01:01:44 +02:00
parent b5e24cbb9c
commit ef768a8307
6 changed files with 432 additions and 265 deletions

View File

@@ -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()
{
}