Cache Full Companion paths and shared secrets to recover RAM
This commit is contained in:
1 parent
5013c8ff34
commit
6db10c3986
27 files changed
+2360
-58
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#include "ContactInfo.h"
|
||||
|
||||
#if MESH_CONTACT_CACHE
|
||||
#include "ContactSecretCache.h"
|
||||
|
||||
#ifndef MAX_CONTACTS
|
||||
#define MAX_CONTACTS 32
|
||||
#endif
|
||||
|
||||
namespace mesh {
|
||||
|
||||
ContactPathStorage& contactPathStorage() {
|
||||
// Eight anonymous peers plus room for independent in-flight snapshots.
|
||||
static ContactPathPool<MAX_CONTACTS + 40> pool;
|
||||
return pool;
|
||||
}
|
||||
|
||||
ContactSecretCache& contactSecretCache() {
|
||||
static ContactSecretCache cache;
|
||||
return cache;
|
||||
}
|
||||
|
||||
} // namespace mesh
|
||||
|
||||
const uint8_t* ContactInfo::getSharedSecret(const mesh::LocalIdentity& self_id) const {
|
||||
return mesh::contactSecretCache().get(self_id, id.pub_key);
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user