diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-19 16:05:03 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-03-19 16:05:03 -0700 |
| commit | 6fdb360e2ab1ed27760e6ea699a1594786bcbe76 (patch) | |
| tree | 16b4c7c348f45589ed4d8e5eab6373db4f748e35 /node/Node.cpp | |
| parent | 0d847d941077eea398638d4077dceaa56aa68cfc (diff) | |
| download | infinitytier-6fdb360e2ab1ed27760e6ea699a1594786bcbe76.tar.gz infinitytier-6fdb360e2ab1ed27760e6ea699a1594786bcbe76.zip | |
More IPC work.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index b76d4b6d..653d63cf 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -99,6 +99,7 @@ Node::NodeControlClient::NodeControlClient(const char *hp,void (*resultHandler)( _impl((void *)new _NodeControlClientImpl) { _NodeControlClientImpl *impl = (_NodeControlClientImpl *)_impl; + impl->ipcc = (IpcConnection *)0; if (!hp) hp = ZT_DEFAULTS.defaultHomePath.c_str(); @@ -121,6 +122,7 @@ Node::NodeControlClient::NodeControlClient(const char *hp,void (*resultHandler)( impl->ipcc = new IpcConnection((std::string(ZT_IPC_ENDPOINT_BASE) + myaddr).c_str(),&_CBipcResultHandler,_impl); impl->ipcc->printf("auth %s"ZT_EOL_S,at.c_str()); } catch ( ... ) { + impl->ipcc = (IpcConnection *)0; impl->err = "failure connecting to running ZeroTier One service"; } } @@ -136,11 +138,20 @@ Node::NodeControlClient::~NodeControlClient() } } +const char *Node::NodeControlClient::error() const + throw() +{ + if (((_NodeControlClientImpl *)_impl)->err.length()) + return ((_NodeControlClientImpl *)_impl)->err.c_str(); + return (const char *)0; +} + void Node::NodeControlClient::send(const char *command) throw() { try { - ((_NodeControlClientImpl *)_impl)->ipcc->printf("%s"ZT_EOL_S,command); + if (((_NodeControlClientImpl *)_impl)->ipcc) + ((_NodeControlClientImpl *)_impl)->ipcc->printf("%s"ZT_EOL_S,command); } catch ( ... ) {} } |
