summaryrefslogtreecommitdiff
path: root/controller/LFDB.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'controller/LFDB.cpp')
-rw-r--r--controller/LFDB.cpp12
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);