This commit is contained in:
Adam Ierymenko 2019-09-16 19:58:21 -07:00
parent 07a480b37a
commit dde937e197
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3
3 changed files with 13 additions and 9 deletions

View File

@ -201,12 +201,13 @@ struct _processBackgroundTasks_ping_eachPeer
void *tPtr; void *tPtr;
Hashtable< void *,bool > *roots; Hashtable< void *,bool > *roots;
ZT_ALWAYS_INLINE void operator()(const SharedPtr<Peer> &peer) ZT_ALWAYS_INLINE bool operator()(const SharedPtr<Peer> &peer)
{ {
if (!roots->contains((void *)peer.ptr())) { if (!roots->contains((void *)peer.ptr())) {
unsigned int v4SendCount = 0,v6SendCount = 0; unsigned int v4SendCount = 0,v6SendCount = 0;
peer->ping(tPtr,now,v4SendCount,v6SendCount); peer->ping(tPtr,now,v4SendCount,v6SendCount);
} }
return true;
} }
}; };

View File

@ -36,13 +36,17 @@ namespace ZeroTier {
class _ResetWithinScope class _ResetWithinScope
{ {
public: 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), _now(now),
_tPtr(tPtr), _tPtr(tPtr),
_family(inetAddressFamily), _family(inetAddressFamily),
_scope(scope) {} _scope(scope) {}
inline void operator()(const SharedPtr<Peer> &p) { p->resetWithinScope(_tPtr,_scope,_family,_now); } ZT_ALWAYS_INLINE bool operator()(const SharedPtr<Peer> &p)
{
p->resetWithinScope(_tPtr,_scope,_family,_now);
return true;
}
private: private:
uint64_t _now; uint64_t _now;
@ -53,9 +57,7 @@ private:
SelfAwareness::SelfAwareness(const RuntimeEnvironment *renv) : SelfAwareness::SelfAwareness(const RuntimeEnvironment *renv) :
RR(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) void SelfAwareness::iam(void *tPtr,const Address &reporter,const int64_t receivedOnLocalSocket,const InetAddress &reporterPhysicalAddress,const InetAddress &myPhysicalAddress,bool trusted,int64_t now)
{ {

View File

@ -243,7 +243,8 @@ public:
Address *a = (Address *)0; Address *a = (Address *)0;
SharedPtr<Peer> *p = (SharedPtr<Peer> *)0; SharedPtr<Peer> *p = (SharedPtr<Peer> *)0;
while (i.next(a,p)) { while (i.next(a,p)) {
f(*((const SharedPtr<Peer> *)p)); if (!f(*((const SharedPtr<Peer> *)p)))
break;
} }
} }
@ -400,7 +401,7 @@ public:
* *
* @param dnsName DNS name to remove * @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); Mutex::Lock l(_dynamicRoots_l);
_dynamicRoots.erase(dnsName); _dynamicRoots.erase(dnsName);
@ -410,7 +411,7 @@ public:
/** /**
* Remove all dynamic roots * Remove all dynamic roots
*/ */
ZT_ALWAYS_INLINE bool clearDynamicRoots() ZT_ALWAYS_INLINE void clearDynamicRoots()
{ {
Mutex::Lock l(_dynamicRoots_l); Mutex::Lock l(_dynamicRoots_l);
_dynamicRoots.clear(); _dynamicRoots.clear();