mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 13:07:55 +00:00
Error recovery for network & member stream watchers
This commit is contained in:
parent
0f17508cac
commit
8b8399efbc
@ -735,6 +735,7 @@ void PostgreSQL::_membersWatcher_Redis() {
|
||||
std::string key = "member-stream:{" + std::string(_myAddress.toString(buf)) + "}";
|
||||
|
||||
while (_run == 1) {
|
||||
try {
|
||||
json tmp;
|
||||
std::unordered_map<std::string, ItemStream> result;
|
||||
if (_rc->clusterMode) {
|
||||
@ -744,20 +745,20 @@ void PostgreSQL::_membersWatcher_Redis() {
|
||||
}
|
||||
if (!result.empty()) {
|
||||
for (auto element : result) {
|
||||
#ifdef ZT_TRACE
|
||||
#ifdef ZT_TRACE
|
||||
fprintf(stdout, "Received notification from: %s\n", element.first.c_str());
|
||||
#endif
|
||||
#endif
|
||||
for (auto rec : element.second) {
|
||||
std::string id = rec.first;
|
||||
auto attrs = rec.second;
|
||||
#ifdef ZT_TRACE
|
||||
#ifdef ZT_TRACE
|
||||
fprintf(stdout, "Record ID: %s\n", id.c_str());
|
||||
fprintf(stdout, "attrs len: %lu\n", attrs.size());
|
||||
#endif
|
||||
#endif
|
||||
for (auto a : attrs) {
|
||||
#ifdef ZT_TRACE
|
||||
#ifdef ZT_TRACE
|
||||
fprintf(stdout, "key: %s\nvalue: %s\n", a.first.c_str(), a.second.c_str());
|
||||
#endif
|
||||
#endif
|
||||
try {
|
||||
tmp = json::parse(a.second);
|
||||
json &ov = tmp["old_val"];
|
||||
@ -780,6 +781,9 @@ void PostgreSQL::_membersWatcher_Redis() {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (sw::redis::Error &e) {
|
||||
fprintf(stderr, "Error in Redis members watcher: %s\n", e.what());
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "membersWatcher ended\n");
|
||||
}
|
||||
@ -856,6 +860,7 @@ void PostgreSQL::_networksWatcher_Redis() {
|
||||
std::string key = "network-stream:{" + std::string(_myAddress.toString(buf)) + "}";
|
||||
|
||||
while (_run == 1) {
|
||||
try {
|
||||
json tmp;
|
||||
std::unordered_map<std::string, ItemStream> result;
|
||||
if (_rc->clusterMode) {
|
||||
@ -902,6 +907,9 @@ void PostgreSQL::_networksWatcher_Redis() {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (sw::redis::Error &e) {
|
||||
fprintf(stderr, "Error in Redis networks watcher: %s\n", e.what());
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "networksWatcher ended\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user