mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 02:27:38 -07:00
Linux build fixes, linux build rule for RethinkDB mode controller, also force disable shitty allocators in libstdc++.
This commit is contained in:
parent
d97adc8789
commit
b68bca35db
7 changed files with 39 additions and 39 deletions
|
@ -496,7 +496,7 @@ void EmbeddedNetworkController::request(
|
|||
qe->identity = identity;
|
||||
qe->metaData = metaData;
|
||||
qe->type = _RQEntry::RQENTRY_TYPE_REQUEST;
|
||||
_queue.post(std::unique_ptr<_RQEntry>(qe));
|
||||
_queue.post(qe);
|
||||
}
|
||||
|
||||
unsigned int EmbeddedNetworkController::handleControlPlaneHttpGET(
|
||||
|
@ -1720,7 +1720,7 @@ void EmbeddedNetworkController::_startThreads()
|
|||
for(long t=0;t<hwc;++t) {
|
||||
_threads.emplace_back([this]() {
|
||||
for(;;) {
|
||||
std::unique_ptr<_RQEntry> qe;
|
||||
_RQEntry *qe = (_RQEntry *)0;
|
||||
if (_queue.get(qe))
|
||||
break;
|
||||
try {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <list>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <atomic>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/NetworkController.hpp"
|
||||
|
@ -239,7 +240,7 @@ private:
|
|||
std::string _signingIdAddressString;
|
||||
NetworkController::Sender *_sender;
|
||||
ControllerDB _db;
|
||||
BlockingQueue< std::unique_ptr<_RQEntry> > _queue;
|
||||
BlockingQueue< _RQEntry * > _queue;
|
||||
std::vector<std::thread> _threads;
|
||||
std::mutex _threads_l;
|
||||
std::unordered_map< _MemberStatusKey,_MemberStatus,_MemberStatusHash > _memberStatus;
|
||||
|
|
|
@ -132,7 +132,7 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddres
|
|||
for(int t=0;t<ZT_CONTROLLER_RETHINKDB_COMMIT_THREADS;++t) {
|
||||
_commitThread[t] = std::thread([this]() {
|
||||
std::unique_ptr<R::Connection> rdb;
|
||||
std::unique_ptr<nlohmann::json> config;
|
||||
nlohmann::json *config = (nlohmann::json *)0;
|
||||
while ((this->_commitQueue.get(config))&&(_run == 1)) {
|
||||
if (!config)
|
||||
continue;
|
||||
|
@ -219,7 +219,7 @@ RethinkDB::~RethinkDB()
|
|||
_networksDbWatcher.join();
|
||||
}
|
||||
|
||||
inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network)
|
||||
bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network)
|
||||
{
|
||||
waitForReady();
|
||||
|
||||
|
@ -238,7 +238,7 @@ inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network)
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member)
|
||||
bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member)
|
||||
{
|
||||
waitForReady();
|
||||
|
||||
|
@ -261,7 +261,7 @@ inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,cons
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,NetworkSummaryInfo &info)
|
||||
bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t memberId,nlohmann::json &member,NetworkSummaryInfo &info)
|
||||
{
|
||||
waitForReady();
|
||||
|
||||
|
@ -285,7 +285,7 @@ inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,cons
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members)
|
||||
bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohmann::json> &members)
|
||||
{
|
||||
waitForReady();
|
||||
|
||||
|
@ -306,7 +306,7 @@ inline bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,std:
|
|||
return true;
|
||||
}
|
||||
|
||||
inline bool RethinkDB::summary(const uint64_t networkId,NetworkSummaryInfo &info)
|
||||
bool RethinkDB::summary(const uint64_t networkId,NetworkSummaryInfo &info)
|
||||
{
|
||||
waitForReady();
|
||||
|
||||
|
@ -337,7 +337,7 @@ void RethinkDB::networks(std::vector<uint64_t> &networks)
|
|||
void RethinkDB::save(const nlohmann::json &record)
|
||||
{
|
||||
waitForReady();
|
||||
_commitQueue.post(std::unique_ptr<nlohmann::json>(new nlohmann::json(record)));
|
||||
_commitQueue.post(new nlohmann::json(record));
|
||||
}
|
||||
|
||||
void RethinkDB::eraseNetwork(const uint64_t networkId)
|
||||
|
@ -345,23 +345,23 @@ void RethinkDB::eraseNetwork(const uint64_t networkId)
|
|||
char tmp2[24];
|
||||
waitForReady();
|
||||
Utils::hex(networkId,tmp2);
|
||||
json tmp;
|
||||
tmp["id"] = tmp2;
|
||||
tmp["objtype"] = "delete_network"; // pseudo-type, tells thread to delete network
|
||||
_commitQueue.post(std::unique_ptr<nlohmann::json>(new nlohmann::json(tmp)));
|
||||
json *tmp = new json();
|
||||
(*tmp)["id"] = tmp2;
|
||||
(*tmp)["objtype"] = "delete_network"; // pseudo-type, tells thread to delete network
|
||||
_commitQueue.post(tmp);
|
||||
}
|
||||
|
||||
void RethinkDB::eraseMember(const uint64_t networkId,const uint64_t memberId)
|
||||
{
|
||||
char tmp2[24];
|
||||
json tmp;
|
||||
json *tmp = new json();
|
||||
waitForReady();
|
||||
Utils::hex(networkId,tmp2);
|
||||
tmp["nwid"] = tmp2;
|
||||
(*tmp)["nwid"] = tmp2;
|
||||
Utils::hex10(memberId,tmp2);
|
||||
tmp["id"] = tmp2;
|
||||
tmp["objtype"] = "delete_member"; // pseudo-type, tells thread to delete network
|
||||
_commitQueue.post(std::unique_ptr<nlohmann::json>(new nlohmann::json(tmp)));
|
||||
(*tmp)["id"] = tmp2;
|
||||
(*tmp)["objtype"] = "delete_member"; // pseudo-type, tells thread to delete network
|
||||
_commitQueue.post(tmp);
|
||||
}
|
||||
|
||||
void RethinkDB::_memberChanged(nlohmann::json &old,nlohmann::json &member)
|
||||
|
@ -511,14 +511,4 @@ void RethinkDB::_networkChanged(nlohmann::json &old,nlohmann::json &network)
|
|||
|
||||
} // namespace ZeroTier
|
||||
|
||||
/*
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
ZeroTier::RethinkDB db(ZeroTier::Address(0x8056c2e21cULL),"10.6.6.188",28015,"ztc","");
|
||||
db.waitForReady();
|
||||
printf("ready.\n");
|
||||
pause();
|
||||
}
|
||||
*/
|
||||
|
||||
#endif // ZT_CONTROLLER_USE_RETHINKDB
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
|
||||
#include "../ext/json/json.hpp"
|
||||
|
||||
|
@ -135,7 +136,7 @@ private:
|
|||
std::unordered_multimap< uint64_t,uint64_t > _networkByMember;
|
||||
mutable std::mutex _networks_l;
|
||||
|
||||
BlockingQueue< std::unique_ptr<nlohmann::json> > _commitQueue;
|
||||
BlockingQueue< nlohmann::json * > _commitQueue;
|
||||
std::thread _commitThread[ZT_CONTROLLER_RETHINKDB_COMMIT_THREADS];
|
||||
|
||||
mutable std::mutex _readyLock; // locked until ready
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue