mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-10-09 06:45:08 +02:00
set objtype on messages received via PubSub
This commit is contained in:
parent
6196e87303
commit
069d7c1862
2 changed files with 7 additions and 5 deletions
|
@ -351,10 +351,10 @@ bool CentralDB::save(nlohmann::json& record, bool notifyListeners)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
fprintf(stderr, "Error on PostgreSQL::save: %s\n", e.what());
|
fprintf(stderr, "Error on CentralDB::save: %s\n", e.what());
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
fprintf(stderr, "Unknown error on PostgreSQL::save\n");
|
fprintf(stderr, "Unknown error on CentralDB::save\n");
|
||||||
}
|
}
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ void CentralDB::eraseNetwork(const uint64_t networkId)
|
||||||
char networkIdStr[17];
|
char networkIdStr[17];
|
||||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||||
|
|
||||||
fprintf(stderr, "PostgreSQL::eraseNetwork\n");
|
fprintf(stderr, "CentralDB::eraseNetwork\n");
|
||||||
char tmp2[24];
|
char tmp2[24];
|
||||||
waitForReady();
|
waitForReady();
|
||||||
Utils::hex(networkId, tmp2);
|
Utils::hex(networkId, tmp2);
|
||||||
|
@ -392,7 +392,7 @@ void CentralDB::eraseMember(const uint64_t networkId, const uint64_t memberId)
|
||||||
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
span->SetAttribute("network_id", Utils::hex(networkId, networkIdStr));
|
||||||
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
span->SetAttribute("member_id", Utils::hex10(memberId, memberIdStr));
|
||||||
|
|
||||||
fprintf(stderr, "PostgreSQL::eraseMember\n");
|
fprintf(stderr, "CentralDB::eraseMember\n");
|
||||||
char tmp2[24];
|
char tmp2[24];
|
||||||
waitForReady();
|
waitForReady();
|
||||||
std::pair<nlohmann::json, bool> tmp, nw;
|
std::pair<nlohmann::json, bool> tmp, nw;
|
||||||
|
@ -467,7 +467,7 @@ AuthInfo CentralDB::getSSOAuthInfo(const nlohmann::json& member, const std::stri
|
||||||
// info.version=1;
|
// info.version=1;
|
||||||
// return info;
|
// return info;
|
||||||
// }
|
// }
|
||||||
// fprintf(stderr, "PostgreSQL::updateMemberOnLoad: %s-%s\n", networkId.c_str(), memberId.c_str());
|
// fprintf(stderr, "CentralDB::updateMemberOnLoad: %s-%s\n", networkId.c_str(), memberId.c_str());
|
||||||
std::shared_ptr<PostgresConnection> c;
|
std::shared_ptr<PostgresConnection> c;
|
||||||
try {
|
try {
|
||||||
c = _pool->borrow();
|
c = _pool->borrow();
|
||||||
|
|
|
@ -277,6 +277,7 @@ nlohmann::json toJson(const pbmessages::NetworkChange_Network& nc, pbmessages::N
|
||||||
{
|
{
|
||||||
nlohmann::json out;
|
nlohmann::json out;
|
||||||
|
|
||||||
|
out["objtype"] = "network";
|
||||||
out["id"] = nc.network_id();
|
out["id"] = nc.network_id();
|
||||||
out["name"] = nc.name();
|
out["name"] = nc.name();
|
||||||
out["capabilities"] = OSUtils::jsonParse(nc.capabilities());
|
out["capabilities"] = OSUtils::jsonParse(nc.capabilities());
|
||||||
|
@ -387,6 +388,7 @@ nlohmann::json toJson(const pbmessages::NetworkChange_Network& nc, pbmessages::N
|
||||||
nlohmann::json toJson(const pbmessages::MemberChange_Member& mc, pbmessages::MemberChange_ChangeSource source)
|
nlohmann::json toJson(const pbmessages::MemberChange_Member& mc, pbmessages::MemberChange_ChangeSource source)
|
||||||
{
|
{
|
||||||
nlohmann::json out;
|
nlohmann::json out;
|
||||||
|
out["objtype"] = "member";
|
||||||
out["id"] = mc.device_id();
|
out["id"] = mc.device_id();
|
||||||
out["nwid"] = mc.network_id();
|
out["nwid"] = mc.network_id();
|
||||||
if (mc.has_remote_trace_target()) {
|
if (mc.has_remote_trace_target()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue