From 470823104613fdb8abd8a2ebae6a5c8d7a5679d2 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 18 Sep 2014 10:01:30 -0700 Subject: Fix for GitHub issue #122 and other fixes --- control/NodeControlService.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'control/NodeControlService.cpp') diff --git a/control/NodeControlService.cpp b/control/NodeControlService.cpp index 5d4d08d6..285eae58 100644 --- a/control/NodeControlService.cpp +++ b/control/NodeControlService.cpp @@ -70,7 +70,7 @@ void NodeControlService::threadMain() break; } else if ((_node->initialized())&&(_node->address())) { Utils::snprintf(tmp,sizeof(tmp),"%s%.10llx",ZT_IPC_ENDPOINT_BASE,(unsigned long long)_node->address()); - _listener = new IpcListener(tmp,&_CBcommandHandler,this); + _listener = new IpcListener(tmp,ZT_IPC_TIMEOUT,&_CBcommandHandler,this); break; } Thread::sleep(100); // wait for Node to start @@ -83,18 +83,18 @@ void NodeControlService::threadMain() void NodeControlService::_CBcommandHandler(void *arg,IpcConnection *ipcc,IpcConnection::EventType event,const char *commandLine) { - if (!((NodeControlService *)arg)->_running) - return; - if ((!commandLine)||(!commandLine[0])) - return; switch(event) { case IpcConnection::IPC_EVENT_COMMAND: { + if ((!((NodeControlService *)arg)->_running)||(!commandLine)||(!commandLine[0])) + return; ((NodeControlService *)arg)->_doCommand(ipcc,commandLine); } break; + case IpcConnection::IPC_EVENT_NEW_CONNECTION: { Mutex::Lock _l(((NodeControlService *)arg)->_connections_m); ((NodeControlService *)arg)->_connections[ipcc] = false; // not yet authenticated } break; + case IpcConnection::IPC_EVENT_CONNECTION_CLOSED: { Mutex::Lock _l(((NodeControlService *)arg)->_connections_m); ((NodeControlService *)arg)->_connections.erase(ipcc); -- cgit v1.2.3