Sync bug fix

This commit is contained in:
Adam Ierymenko 2019-08-08 16:30:52 -05:00
parent 28d0070ce2
commit 760ae07d72
No known key found for this signature in database
GPG key ID: 1657198823E52A61

View file

@ -220,9 +220,6 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
const uint64_t id = Utils::hexStrToU64(idstr.c_str()); const uint64_t id = Utils::hexStrToU64(idstr.c_str());
if ((id >> 24) == controllerAddressInt) { // sanity check if ((id >> 24) == controllerAddressInt) { // sanity check
std::lock_guard<std::mutex> sl(_state_l);
_NetworkState &ns = _state[id];
if (!ns.dirty) {
nlohmann::json oldNetwork; nlohmann::json oldNetwork;
if ((timeRangeStart > 0)&&(get(id,oldNetwork))) { if ((timeRangeStart > 0)&&(get(id,oldNetwork))) {
const uint64_t revision = network["revision"]; const uint64_t revision = network["revision"];
@ -234,7 +231,6 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
nlohmann::json nullJson; nlohmann::json nullJson;
_networkChanged(nullJson,network,timeRangeStart > 0); _networkChanged(nullJson,network,timeRangeStart > 0);
} }
}
} }
} }
@ -294,17 +290,13 @@ LFDB::LFDB(const Identity &myId,const char *path,const char *lfOwnerPrivate,cons
const uint64_t id = Utils::hexStrToU64(idstr.c_str()); const uint64_t id = Utils::hexStrToU64(idstr.c_str());
if ((id)&&((nwid >> 24) == controllerAddressInt)) { // sanity check if ((id)&&((nwid >> 24) == controllerAddressInt)) { // sanity check
std::lock_guard<std::mutex> sl(_state_l);
auto ns = _state.find(nwid);
if ((ns == _state.end())||(!ns->second.members[id].dirty)) {
nlohmann::json network,oldMember; nlohmann::json network,oldMember;
if ((timeRangeStart > 0)&&(get(nwid,network,id,oldMember))) { if ((timeRangeStart > 0)&&(get(nwid,network,id,oldMember))) {
const uint64_t revision = member["revision"]; const uint64_t revision = member["revision"];
const uint64_t prevRevision = oldMember["revision"]; const uint64_t prevRevision = oldMember["revision"];
if (prevRevision < revision) if (prevRevision < revision)
_memberChanged(oldMember,member,timeRangeStart > 0); _memberChanged(oldMember,member,timeRangeStart > 0);
} } else if (network.is_object()) {
} else {
nlohmann::json nullJson; nlohmann::json nullJson;
_memberChanged(nullJson,member,timeRangeStart > 0); _memberChanged(nullJson,member,timeRangeStart > 0);
} }