latest
This commit is contained in:
parent
2e52a1eebf
commit
88a3c685fb
4 changed files with 27 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue