cosmetic
This commit is contained in:
@@ -27,36 +27,36 @@ extern Appl& A;
|
||||
|
||||
BaseLoop::BaseLoop()
|
||||
{
|
||||
// create Commands DB
|
||||
// create commands DB
|
||||
m_commands = ConfigCommands(A.getParam<const char*>("p_ebusconfdir"), CSV).getCommands();
|
||||
L.log(bas, trace, "ebus configuration dir: %s", A.getParam<const char*>("p_ebusconfdir"));
|
||||
L.log(bas, event, "commands DB: %d ", m_commands->sizeCmdDB());
|
||||
L.log(bas, event, " cycle DB: %d ", m_commands->sizeCycDB());
|
||||
L.log(bas, event, " polling DB: %d ", m_commands->sizePolDB());
|
||||
|
||||
// create EBusLoop
|
||||
// create ebusloop
|
||||
m_ebusloop = new EBusLoop(m_commands);
|
||||
m_ebusloop->start("ebusloop");
|
||||
|
||||
// create Network
|
||||
// create network
|
||||
m_network = new Network(A.getParam<bool>("p_localhost"), &m_msgQueue);
|
||||
m_network->start("network");
|
||||
}
|
||||
|
||||
BaseLoop::~BaseLoop()
|
||||
{
|
||||
// free Network
|
||||
// free network
|
||||
if (m_network != NULL)
|
||||
delete m_network;
|
||||
|
||||
// free EBusLoop
|
||||
// free ebusloop
|
||||
if (m_ebusloop != NULL) {
|
||||
m_ebusloop->stop();
|
||||
m_ebusloop->join();
|
||||
delete m_ebusloop;
|
||||
}
|
||||
|
||||
// free Commands DB
|
||||
// free commands DB
|
||||
if (m_commands != NULL)
|
||||
delete m_commands;
|
||||
}
|
||||
@@ -343,7 +343,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
}
|
||||
|
||||
{
|
||||
// create Commands DB
|
||||
// create commands DB
|
||||
Commands* commands = ConfigCommands(A.getParam<const char*>("p_ebusconfdir"), CSV).getCommands();
|
||||
L.log(bas, trace, "ebus configuration dir: %s", A.getParam<const char*>("p_ebusconfdir"));
|
||||
L.log(bas, event, "commands DB: %d ", m_commands->sizeCmdDB());
|
||||
|
||||
@@ -29,11 +29,11 @@ Network::Network(const bool localhost, WQueue<Message*>* msgQueue)
|
||||
: m_msgQueue(msgQueue), m_listening(false), m_running(false)
|
||||
{
|
||||
if (localhost == true)
|
||||
m_Server = new TCPServer(A.getParam<int>("p_port"), "127.0.0.1");
|
||||
m_tcpServer = new TCPServer(A.getParam<int>("p_port"), "127.0.0.1");
|
||||
else
|
||||
m_Server = new TCPServer(A.getParam<int>("p_port"), "0.0.0.0");
|
||||
m_tcpServer = new TCPServer(A.getParam<int>("p_port"), "0.0.0.0");
|
||||
|
||||
if (m_Server != NULL && m_Server->start() == 0)
|
||||
if (m_tcpServer != NULL && m_tcpServer->start() == 0)
|
||||
m_listening = true;
|
||||
|
||||
}
|
||||
@@ -51,7 +51,7 @@ Network::~Network()
|
||||
if (m_running == true)
|
||||
stop();
|
||||
|
||||
delete m_Server;
|
||||
delete m_tcpServer;
|
||||
}
|
||||
|
||||
void* Network::run()
|
||||
@@ -67,10 +67,10 @@ void* Network::run()
|
||||
|
||||
FD_ZERO(&checkfds);
|
||||
FD_SET(m_notify.notifyFD(), &checkfds);
|
||||
FD_SET(m_Server->getFD(), &checkfds);
|
||||
FD_SET(m_tcpServer->getFD(), &checkfds);
|
||||
|
||||
(m_notify.notifyFD() > m_Server->getFD()) ?
|
||||
(maxfd = m_notify.notifyFD()) : (maxfd = m_Server->getFD());
|
||||
(m_notify.notifyFD() > m_tcpServer->getFD()) ?
|
||||
(maxfd = m_notify.notifyFD()) : (maxfd = m_tcpServer->getFD());
|
||||
|
||||
for (;;) {
|
||||
fd_set readfds;
|
||||
@@ -96,8 +96,8 @@ void* Network::run()
|
||||
}
|
||||
|
||||
// new data from socket
|
||||
if (FD_ISSET(m_Server->getFD(), &readfds)) {
|
||||
TCPSocket* socket = m_Server->newSocket();
|
||||
if (FD_ISSET(m_tcpServer->getFD(), &readfds)) {
|
||||
TCPSocket* socket = m_tcpServer->newSocket();
|
||||
if (socket == NULL)
|
||||
continue;
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public:
|
||||
private:
|
||||
std::list<Connection*> m_connections;
|
||||
WQueue<Message*>* m_msgQueue;
|
||||
TCPServer* m_Server;
|
||||
TCPServer* m_tcpServer;
|
||||
Notify m_notify;
|
||||
bool m_listening;
|
||||
bool m_running;
|
||||
|
||||
Reference in New Issue
Block a user