diff --git a/node/CMakeLists.txt b/node/CMakeLists.txt index 4d604b4b5..e25ff4318 100644 --- a/node/CMakeLists.txt +++ b/node/CMakeLists.txt @@ -7,7 +7,6 @@ endif(WIN32) set(core_headers Address.hpp - AES.hpp AtomicCounter.hpp Buffer.hpp C25519.hpp @@ -50,8 +49,6 @@ set(core_headers ) set(core_src - AES.cpp - AES-aesni.c C25519.cpp Credential.cpp ECC384.cpp diff --git a/node/Topology.hpp b/node/Topology.hpp index fc66b665a..eb4f3240a 100644 --- a/node/Topology.hpp +++ b/node/Topology.hpp @@ -68,12 +68,12 @@ private: { // assumes _roots_l is locked _rootIdentities.clear(); - Hashtable< Str,Locator >::Iterator i(_roots); + Hashtable< Str,SharedPtr >::Iterator i(_roots); Str *k = (Str *)0; SharedPtr< const Locator > *v = (SharedPtr< const Locator > *)0; while (i.next(k,v)) { if (*v) - _rootIdentities.set(v->id(),true); + _rootIdentities.set((*v)->id(),true); } } @@ -327,19 +327,19 @@ public: * @param latestLocator Latest locator * @return True if locator is newer or if a new entry was created */ - inline bool setRoot(const Str &name,const Locator &latestLocator) + inline bool setRoot(const Str &name,const SharedPtr &latestLocator) { Mutex::Lock l(_roots_l); if (latestLocator) { - Locator &ll = _roots[name]; - if (ll.timestamp() < latestLocator.timestamp()) { + SharedPtr &ll = _roots[name]; + if ((ll)&&(ll->timestamp() < latestLocator->timestamp())) { ll = latestLocator; _updateRoots(); _rootsModified = true; return true; } } else if (!_roots.contains(name)) { - _roots.set(name,Locator()); // no locator known yet, but add name to name list to trigger DNS refreshing + _roots.set(name,SharedPtr()); // no locator known yet, but add name to name list to trigger DNS refreshing _rootsModified = true; return true; } @@ -374,17 +374,22 @@ public: unsigned int c = 0; Str *k = (Str *)0; - Locator *v = (Locator *)0; - Hashtable< Str,Locator >::Iterator i(const_cast(this)->_roots); + SharedPtr *v = (SharedPtr *)0; + Hashtable< Str,SharedPtr >::Iterator i(const_cast(this)->_roots); while (i.next(k,v)) { Utils::scopy(nptr,256,k->c_str()); rl->roots[c].name = nptr; nptr += 256; - lbuf->clear(); - v->serialize(*lbuf); - memcpy(lptr,lbuf->unsafeData(),lbuf->size()); - rl->roots[c].locator = lptr; - rl->roots[c].locatorSize = lbuf->size(); + if (*v) { + lbuf->clear(); + (*v)->serialize(*lbuf); + memcpy(lptr,lbuf->unsafeData(),lbuf->size()); + rl->roots[c].locator = lptr; + rl->roots[c].locatorSize = lbuf->size(); + } else { + rl->roots[c].locator = nullptr; + rl->roots[c].locatorSize = 0; + } lptr += 65536; ++c; }