From d97adc8789c2a38d0106c83b0f02522f9cf0d7dd Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 3 Nov 2017 12:32:56 -0700 Subject: Preparing for test. --- controller/RethinkDB.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'controller/RethinkDB.cpp') diff --git a/controller/RethinkDB.cpp b/controller/RethinkDB.cpp index 2d28dab2..ec6aae4e 100644 --- a/controller/RethinkDB.cpp +++ b/controller/RethinkDB.cpp @@ -164,6 +164,9 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddres const std::string tmp = (*config)["id"]; deleteId.append(tmp); table = "Member"; + } else if (objtype == "trace") { + record = *config; + table = "RemoteTrace"; } else { continue; } @@ -452,6 +455,21 @@ void RethinkDB::_memberChanged(nlohmann::json &old,nlohmann::json &member) _controller->onNetworkMemberUpdate(networkId,memberId); } + } else if (memberId) { + if (nw) { + std::lock_guard l(nw->lock); + nw->members.erase(memberId); + } + if (networkId) { + std::lock_guard l(_networks_l); + auto er = _networkByMember.equal_range(memberId); + for(auto i=er.first;i!=er.second;++i) { + if (i->second == networkId) { + _networkByMember.erase(i); + break; + } + } + } } if ((wasAuth)&&(!isAuth)&&(networkId)&&(memberId)) -- cgit v1.2.3