From dde937e197c28e43fb90cfc075975e9a9c2ad8f9 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 16 Sep 2019 19:58:21 -0700 Subject: [PATCH] cleanup --- node/Node.cpp | 3 ++- node/SelfAwareness.cpp | 12 +++++++----- node/Topology.hpp | 7 ++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/node/Node.cpp b/node/Node.cpp index fccfb01c7..e4fc90937 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -201,12 +201,13 @@ struct _processBackgroundTasks_ping_eachPeer void *tPtr; Hashtable< void *,bool > *roots; - ZT_ALWAYS_INLINE void operator()(const SharedPtr &peer) + ZT_ALWAYS_INLINE bool operator()(const SharedPtr &peer) { if (!roots->contains((void *)peer.ptr())) { unsigned int v4SendCount = 0,v6SendCount = 0; peer->ping(tPtr,now,v4SendCount,v6SendCount); } + return true; } }; diff --git a/node/SelfAwareness.cpp b/node/SelfAwareness.cpp index 1273d2866..4e91a3ba6 100644 --- a/node/SelfAwareness.cpp +++ b/node/SelfAwareness.cpp @@ -36,13 +36,17 @@ namespace ZeroTier { class _ResetWithinScope { public: - inline _ResetWithinScope(void *tPtr,int64_t now,int inetAddressFamily,InetAddress::IpScope scope) : + ZT_ALWAYS_INLINE _ResetWithinScope(void *tPtr,int64_t now,int inetAddressFamily,InetAddress::IpScope scope) : _now(now), _tPtr(tPtr), _family(inetAddressFamily), _scope(scope) {} - inline void operator()(const SharedPtr &p) { p->resetWithinScope(_tPtr,_scope,_family,_now); } + ZT_ALWAYS_INLINE bool operator()(const SharedPtr &p) + { + p->resetWithinScope(_tPtr,_scope,_family,_now); + return true; + } private: uint64_t _now; @@ -53,9 +57,7 @@ private: SelfAwareness::SelfAwareness(const RuntimeEnvironment *renv) : RR(renv), - _phy(128) -{ -} + _phy(128) {} void SelfAwareness::iam(void *tPtr,const Address &reporter,const int64_t receivedOnLocalSocket,const InetAddress &reporterPhysicalAddress,const InetAddress &myPhysicalAddress,bool trusted,int64_t now) { diff --git a/node/Topology.hpp b/node/Topology.hpp index 83a4ae447..a67720921 100644 --- a/node/Topology.hpp +++ b/node/Topology.hpp @@ -243,7 +243,8 @@ public: Address *a = (Address *)0; SharedPtr *p = (SharedPtr *)0; while (i.next(a,p)) { - f(*((const SharedPtr *)p)); + if (!f(*((const SharedPtr *)p))) + break; } } @@ -400,7 +401,7 @@ public: * * @param dnsName DNS name to remove */ - ZT_ALWAYS_INLINE bool removeDynamicRoot(const Str &dnsName) + ZT_ALWAYS_INLINE void removeDynamicRoot(const Str &dnsName) { Mutex::Lock l(_dynamicRoots_l); _dynamicRoots.erase(dnsName); @@ -410,7 +411,7 @@ public: /** * Remove all dynamic roots */ - ZT_ALWAYS_INLINE bool clearDynamicRoots() + ZT_ALWAYS_INLINE void clearDynamicRoots() { Mutex::Lock l(_dynamicRoots_l); _dynamicRoots.clear();