mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-08-02 15:02:50 +02:00
udno
This commit is contained in:
parent
a0253a0970
commit
4c4a360469
1 changed files with 46 additions and 50 deletions
|
@ -112,64 +112,60 @@ bool CV2::isReady()
|
||||||
|
|
||||||
void CV2::_memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners)
|
void CV2::_memberChanged(nlohmann::json& old, nlohmann::json& memberConfig, bool notifyListeners)
|
||||||
{
|
{
|
||||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
// auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||||
auto tracer = provider->GetTracer("cv2");
|
// auto tracer = provider->GetTracer("cv2");
|
||||||
auto span = tracer->StartSpan("cv2::_memberChanged");
|
// auto span = tracer->StartSpan("cv2::_memberChanged");
|
||||||
auto scope = tracer->WithActiveSpan(span);
|
// auto scope = tracer->WithActiveSpan(span);
|
||||||
|
|
||||||
if (memberConfig.is_object()) {
|
// if (memberConfig.is_object()) {
|
||||||
// member config change
|
// // member config change
|
||||||
const std::string ids = memberConfig["id"];
|
// const std::string ids = memberConfig["id"];
|
||||||
const uint64_t networkId = OSUtils::jsonIntHex(memberConfig["nwid"], 0ULL);
|
// const uint64_t networkId = OSUtils::jsonIntHex(memberConfig["nwid"], 0ULL);
|
||||||
const uint64_t memberId = Utils::hexStrToU64(ids.c_str());
|
// const uint64_t memberId = Utils::hexStrToU64(ids.c_str());
|
||||||
if ((networkId) && (memberId)) {
|
// if ((networkId) && (memberId)) {
|
||||||
save(memberConfig, notifyListeners);
|
// save(memberConfig, notifyListeners);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (old.is_object()) {
|
// else if (old.is_object()) {
|
||||||
// member delete
|
// // member delete
|
||||||
const std::string ids = old["id"];
|
// const std::string ids = old["id"];
|
||||||
const uint64_t networkId = OSUtils::jsonIntHex(old["nwid"], 0ULL);
|
// const uint64_t networkId = OSUtils::jsonIntHex(old["nwid"], 0ULL);
|
||||||
const uint64_t memberId = Utils::hexStrToU64(ids.c_str());
|
// const uint64_t memberId = Utils::hexStrToU64(ids.c_str());
|
||||||
if ((networkId) && (memberId)) {
|
// if ((networkId) && (memberId)) {
|
||||||
eraseMember(networkId, memberId);
|
// eraseMember(networkId, memberId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (notifyListeners) {
|
// fprintf(stderr, "CV2::_memberChanged\n");
|
||||||
// fprintf(stderr, "CV2::_memberChanged\n");
|
DB::_memberChanged(old, memberConfig, notifyListeners);
|
||||||
DB::_memberChanged(old, memberConfig, notifyListeners);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CV2::_networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners)
|
void CV2::_networkChanged(nlohmann::json& old, nlohmann::json& networkConfig, bool notifyListeners)
|
||||||
{
|
{
|
||||||
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
// auto provider = opentelemetry::trace::Provider::GetTracerProvider();
|
||||||
auto tracer = provider->GetTracer("cv2");
|
// auto tracer = provider->GetTracer("cv2");
|
||||||
auto span = tracer->StartSpan("cv2::_networkChanged");
|
// auto span = tracer->StartSpan("cv2::_networkChanged");
|
||||||
auto scope = tracer->WithActiveSpan(span);
|
// auto scope = tracer->WithActiveSpan(span);
|
||||||
|
|
||||||
if (networkConfig.is_object()) {
|
// if (networkConfig.is_object()) {
|
||||||
// network config change
|
// // network config change
|
||||||
const std::string ids = networkConfig["id"];
|
// const std::string ids = networkConfig["id"];
|
||||||
const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
// const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
||||||
if (networkId) {
|
// if (networkId) {
|
||||||
save(networkConfig, notifyListeners);
|
// save(networkConfig, notifyListeners);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (old.is_object()) {
|
// else if (old.is_object()) {
|
||||||
// network delete
|
// // network delete
|
||||||
const std::string ids = networkConfig["id"];
|
// const std::string ids = networkConfig["id"];
|
||||||
const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
// const uint64_t networkId = Utils::hexStrToU64(ids.c_str());
|
||||||
if (networkId) {
|
// if (networkId) {
|
||||||
eraseNetwork(networkId);
|
// eraseNetwork(networkId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (notifyListeners) {
|
// fprintf(stderr, "CV2::_networkChanged\n");
|
||||||
// fprintf(stderr, "CV2::_networkChanged\n");
|
DB::_networkChanged(old, networkConfig, false);
|
||||||
DB::_networkChanged(old, networkConfig, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CV2::save(nlohmann::json& record, bool notifyListeners)
|
bool CV2::save(nlohmann::json& record, bool notifyListeners)
|
||||||
|
|
Loading…
Add table
Reference in a new issue