diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-18 10:01:30 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-18 10:01:30 -0700 |
| commit | 470823104613fdb8abd8a2ebae6a5c8d7a5679d2 (patch) | |
| tree | ccedc83e1e855a8af348514fae4655b875c24823 /control/NodeControlService.cpp | |
| parent | 924f03099412f989ee99a117239f8e326a1c3d00 (diff) | |
| download | infinitytier-470823104613fdb8abd8a2ebae6a5c8d7a5679d2.tar.gz infinitytier-470823104613fdb8abd8a2ebae6a5c8d7a5679d2.zip | |
Fix for GitHub issue #122 and other fixes
Diffstat (limited to 'control/NodeControlService.cpp')
| -rw-r--r-- | control/NodeControlService.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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); |
