summaryrefslogtreecommitdiff
path: root/controller/EmbeddedNetworkController.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-11-03 22:40:26 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-11-03 22:40:26 -0400
commit7fc9094d8ea1c2d28d003c499016f0755b73063d (patch)
tree9f5b5fd51aad00bc964e06e188486d026b0e27e3 /controller/EmbeddedNetworkController.cpp
parent92c7070aa85425041f856d7e4203bdd1ae713c33 (diff)
downloadinfinitytier-7fc9094d8ea1c2d28d003c499016f0755b73063d.tar.gz
infinitytier-7fc9094d8ea1c2d28d003c499016f0755b73063d.zip
More fixes to RethinkDB.
Diffstat (limited to 'controller/EmbeddedNetworkController.cpp')
-rw-r--r--controller/EmbeddedNetworkController.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp
index 1ca2ee08..5707e6e0 100644
--- a/controller/EmbeddedNetworkController.cpp
+++ b/controller/EmbeddedNetworkController.cpp
@@ -1185,8 +1185,9 @@ void EmbeddedNetworkController::_request(
ms.lastRequestTime = now;
}
- OSUtils::ztsnprintf(nwids,sizeof(nwids),"%.16llx",nwid);
- if (!_db->get(nwid,network,identity.address().toInt(),member,ns)) {
+ Utils::hex(nwid,nwids);
+ _db->get(nwid,network,identity.address().toInt(),member,ns);
+ if ((!network.is_object())||(network.size() == 0)) {
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_OBJECT_NOT_FOUND);
return;
}
@@ -1684,11 +1685,13 @@ void EmbeddedNetworkController::_startThreads()
_threads.emplace_back([this]() {
for(;;) {
_RQEntry *qe = (_RQEntry *)0;
- if (_queue.get(qe))
+ if (!_queue.get(qe))
break;
try {
- if (qe)
+ if (qe) {
_request(qe->nwid,qe->fromAddr,qe->requestPacketId,qe->identity,qe->metaData);
+ delete qe;
+ }
} catch (std::exception &e) {
fprintf(stderr,"ERROR: exception in controller request handling thread: %s" ZT_EOL_S,e.what());
} catch ( ... ) {