From b68bca35db1e8515ad981f8ebaef92637fa5b036 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 3 Nov 2017 16:59:36 -0400 Subject: Linux build fixes, linux build rule for RethinkDB mode controller, also force disable shitty allocators in libstdc++. --- controller/RethinkDB.cpp | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'controller/RethinkDB.cpp') diff --git a/controller/RethinkDB.cpp b/controller/RethinkDB.cpp index ec6aae4e..6e656d23 100644 --- a/controller/RethinkDB.cpp +++ b/controller/RethinkDB.cpp @@ -132,7 +132,7 @@ RethinkDB::RethinkDB(EmbeddedNetworkController *const nc,const Address &myAddres for(int t=0;t rdb; - std::unique_ptr 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 &members) +bool RethinkDB::get(const uint64_t networkId,nlohmann::json &network,std::vector &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 &networks) void RethinkDB::save(const nlohmann::json &record) { waitForReady(); - _commitQueue.post(std::unique_ptr(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(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(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 -- cgit v1.2.3