mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-08 19:54:16 +00:00
Preparing for test.
This commit is contained in:
parent
f5014d7d71
commit
d97adc8789
@ -1064,7 +1064,6 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
|
||||
|
||||
void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
{
|
||||
/*
|
||||
static volatile unsigned long idCounter = 0;
|
||||
char id[128],tmp[128];
|
||||
std::string k,v;
|
||||
@ -1107,10 +1106,10 @@ void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
d["objtype"] = "trace";
|
||||
d["ts"] = now;
|
||||
d["nodeId"] = Utils::hex10(rt.origin,tmp);
|
||||
_db.save(d);
|
||||
} catch ( ... ) {
|
||||
// drop invalid trace messages if an error occurs
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void EmbeddedNetworkController::onNetworkUpdate(const uint64_t networkId)
|
||||
|
@ -19,8 +19,6 @@
|
||||
#ifndef ZT_SQLITENETWORKCONTROLLER_HPP
|
||||
#define ZT_SQLITENETWORKCONTROLLER_HPP
|
||||
|
||||
#define ZT_CONTROLLER_USE_RETHINKDB
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
|
@ -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<std::mutex> l(nw->lock);
|
||||
nw->members.erase(memberId);
|
||||
}
|
||||
if (networkId) {
|
||||
std::lock_guard<std::mutex> 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))
|
||||
|
@ -132,6 +132,7 @@ private:
|
||||
std::thread _membersDbWatcher;
|
||||
|
||||
std::unordered_map< uint64_t,std::shared_ptr<_Network> > _networks;
|
||||
std::unordered_multimap< uint64_t,uint64_t > _networkByMember;
|
||||
mutable std::mutex _networks_l;
|
||||
|
||||
BlockingQueue< std::unique_ptr<nlohmann::json> > _commitQueue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user