This commit is contained in:
Grant Limberg 2020-08-04 13:52:57 -07:00
parent 2e52a1eebf
commit 88a3c685fb
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
4 changed files with 27 additions and 0 deletions

View file

@ -48,6 +48,8 @@ void DB::initNetwork(nlohmann::json &network)
{ "type","ACTION_ACCEPT" }
}};
}
if (!network.count("dns")) network["dns"] = nlohmann::json::array();
network["objtype"] = "network";
}
@ -110,6 +112,7 @@ bool DB::get(const uint64_t networkId,nlohmann::json &network)
std::lock_guard<std::mutex> l2(nw->lock);
network = nw->config;
}
fprintf(stderr, "DB::get(uint64_t,json): %s %s\n", OSUtils::jsonString(network["nwid"],"").c_str(), OSUtils::jsonDump(network["dns"], 2).c_str());
return true;
}
@ -132,6 +135,7 @@ bool DB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t mem
return false;
member = m->second;
}
fprintf(stderr, "DB::get(uint64_t,json,uint64_t,mjson): %s %s\n", OSUtils::jsonString(network["nwid"],"").c_str(), OSUtils::jsonDump(network["dns"], 2).c_str());
return true;
}
@ -155,6 +159,7 @@ bool DB::get(const uint64_t networkId,nlohmann::json &network,const uint64_t mem
return false;
member = m->second;
}
fprintf(stderr, "DB::get(uint64_t,json,uint64_t,mjson,summary): %s %s\n", OSUtils::jsonString(network["nwid"],"").c_str(), OSUtils::jsonDump(network["dns"], 2).c_str());
return true;
}
@ -175,6 +180,7 @@ bool DB::get(const uint64_t networkId,nlohmann::json &network,std::vector<nlohma
for(auto m=nw->members.begin();m!=nw->members.end();++m)
members.push_back(m->second);
}
fprintf(stderr, "DB::get(uint64_t,json,members): %s %s\n", OSUtils::jsonString(network["nwid"],"").c_str(), OSUtils::jsonDump(network["dns"], 2).c_str());
return true;
}
@ -305,6 +311,7 @@ void DB::_networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool
{
if (networkConfig.is_object()) {
const std::string ids = networkConfig["id"];
fprintf(stderr, "DB::_networkChanged(): %s\n", OSUtils::jsonDump(networkConfig["dns"]).c_str());
const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
if (networkId) {
std::shared_ptr<_Network> nw;