diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-08-06 08:51:23 -0500 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-08-06 08:51:23 -0500 |
commit | 3c776675b3824d4497d913386793efaece2ee7d1 (patch) | |
tree | 92d0cccb701a041cb9aa730d1baf028568137835 /controller/LFDB.cpp | |
parent | 37d508ab969afaf16c2aee1838a225022de34177 (diff) | |
download | infinitytier-3c776675b3824d4497d913386793efaece2ee7d1.tar.gz infinitytier-3c776675b3824d4497d913386793efaece2ee7d1.zip |
Cruftectomy, work in progress on mirrorring
Diffstat (limited to 'controller/LFDB.cpp')
-rw-r--r-- | controller/LFDB.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/controller/LFDB.cpp b/controller/LFDB.cpp index 9203a5a1..5bf0aaf7 100644 --- a/controller/LFDB.cpp +++ b/controller/LFDB.cpp @@ -335,16 +335,8 @@ bool LFDB::isReady() return (_ready.load()); } -void LFDB::save(nlohmann::json *orig,nlohmann::json &record) +void LFDB::save(nlohmann::json &record) { - if (orig) { - if (*orig != record) { - record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1; - } - } else { - record["revision"] = 1; - } - const std::string objtype = record["objtype"]; if (objtype == "network") { const uint64_t nwid = OSUtils::jsonIntHex(record["id"],0ULL); @@ -352,6 +344,7 @@ void LFDB::save(nlohmann::json *orig,nlohmann::json &record) nlohmann::json old; get(nwid,old); if ((!old.is_object())||(old != record)) { + record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL; _networkChanged(old,record,true); { std::lock_guard<std::mutex> l(_state_l); @@ -366,6 +359,7 @@ void LFDB::save(nlohmann::json *orig,nlohmann::json &record) nlohmann::json network,old; get(nwid,network,id,old); if ((!old.is_object())||(old != record)) { + record["revision"] = OSUtils::jsonInt(record["revision"],0ULL) + 1ULL; _memberChanged(old,record,true); { std::lock_guard<std::mutex> l(_state_l); |