mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-20 00:37:36 +00:00
Add evicted age and accessor in NodeDB
This commit is contained in:
@@ -2029,6 +2029,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
||||
}
|
||||
// if we found a "boring" node, evict it
|
||||
if (oldestBoringIndex != -1) {
|
||||
evictedAge = sinceLastSeen(&meshNodes->at(oldestBoringIndex));
|
||||
oldestIndex = oldestBoringIndex;
|
||||
}
|
||||
|
||||
@@ -2040,6 +2041,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
|
||||
(numMeshNodes)--;
|
||||
}
|
||||
}
|
||||
LOG_WARN("Evicted node %u secs old", evictedAge);
|
||||
// add the node at the end
|
||||
lite = &meshNodes->at((numMeshNodes)++);
|
||||
|
||||
|
||||
@@ -307,7 +307,10 @@ class NodeDB
|
||||
newStatus.notifyObservers(&status);
|
||||
}
|
||||
|
||||
uint32_t get_evicted_age() { return evictedAge; }
|
||||
|
||||
private:
|
||||
uint32_t evictedAge = UINT32_MAX;
|
||||
bool duplicateWarned = false;
|
||||
bool localPositionUpdatedSinceBoot = false;
|
||||
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash
|
||||
|
||||
Reference in New Issue
Block a user