Build fixes.

This commit is contained in:
Adam Ierymenko 2019-11-19 16:45:53 -08:00
parent a16a0a8ce5
commit 5a4d681af8
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
2 changed files with 18 additions and 16 deletions

View file

@ -7,7 +7,6 @@ endif(WIN32)
set(core_headers set(core_headers
Address.hpp Address.hpp
AES.hpp
AtomicCounter.hpp AtomicCounter.hpp
Buffer.hpp Buffer.hpp
C25519.hpp C25519.hpp
@ -50,8 +49,6 @@ set(core_headers
) )
set(core_src set(core_src
AES.cpp
AES-aesni.c
C25519.cpp C25519.cpp
Credential.cpp Credential.cpp
ECC384.cpp ECC384.cpp

View file

@ -68,12 +68,12 @@ private:
{ {
// assumes _roots_l is locked // assumes _roots_l is locked
_rootIdentities.clear(); _rootIdentities.clear();
Hashtable< Str,Locator >::Iterator i(_roots); Hashtable< Str,SharedPtr<const Locator> >::Iterator i(_roots);
Str *k = (Str *)0; Str *k = (Str *)0;
SharedPtr< const Locator > *v = (SharedPtr< const Locator > *)0; SharedPtr< const Locator > *v = (SharedPtr< const Locator > *)0;
while (i.next(k,v)) { while (i.next(k,v)) {
if (*v) if (*v)
_rootIdentities.set(v->id(),true); _rootIdentities.set((*v)->id(),true);
} }
} }
@ -327,19 +327,19 @@ public:
* @param latestLocator Latest locator * @param latestLocator Latest locator
* @return True if locator is newer or if a new entry was created * @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<const Locator> &latestLocator)
{ {
Mutex::Lock l(_roots_l); Mutex::Lock l(_roots_l);
if (latestLocator) { if (latestLocator) {
Locator &ll = _roots[name]; SharedPtr<const Locator> &ll = _roots[name];
if (ll.timestamp() < latestLocator.timestamp()) { if ((ll)&&(ll->timestamp() < latestLocator->timestamp())) {
ll = latestLocator; ll = latestLocator;
_updateRoots(); _updateRoots();
_rootsModified = true; _rootsModified = true;
return true; return true;
} }
} else if (!_roots.contains(name)) { } 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<const Locator>()); // no locator known yet, but add name to name list to trigger DNS refreshing
_rootsModified = true; _rootsModified = true;
return true; return true;
} }
@ -374,17 +374,22 @@ public:
unsigned int c = 0; unsigned int c = 0;
Str *k = (Str *)0; Str *k = (Str *)0;
Locator *v = (Locator *)0; SharedPtr<const Locator> *v = (SharedPtr<const Locator> *)0;
Hashtable< Str,Locator >::Iterator i(const_cast<Topology *>(this)->_roots); Hashtable< Str,SharedPtr<const Locator> >::Iterator i(const_cast<Topology *>(this)->_roots);
while (i.next(k,v)) { while (i.next(k,v)) {
Utils::scopy(nptr,256,k->c_str()); Utils::scopy(nptr,256,k->c_str());
rl->roots[c].name = nptr; rl->roots[c].name = nptr;
nptr += 256; nptr += 256;
if (*v) {
lbuf->clear(); lbuf->clear();
v->serialize(*lbuf); (*v)->serialize(*lbuf);
memcpy(lptr,lbuf->unsafeData(),lbuf->size()); memcpy(lptr,lbuf->unsafeData(),lbuf->size());
rl->roots[c].locator = lptr; rl->roots[c].locator = lptr;
rl->roots[c].locatorSize = lbuf->size(); rl->roots[c].locatorSize = lbuf->size();
} else {
rl->roots[c].locator = nullptr;
rl->roots[c].locatorSize = 0;
}
lptr += 65536; lptr += 65536;
++c; ++c;
} }