From 63ec19674c423b3d93185a690cff3f355c8d9c17 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 19 Mar 2019 16:43:43 -0700 Subject: . --- node/Membership.cpp | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'node/Membership.cpp') diff --git a/node/Membership.cpp b/node/Membership.cpp index 35785283..aa6d4359 100644 --- a/node/Membership.cpp +++ b/node/Membership.cpp @@ -35,61 +35,41 @@ #include "Node.hpp" #include "Trace.hpp" -#define ZT_CREDENTIAL_PUSH_EVERY (ZT_NETWORK_AUTOCONF_DELAY / 3) - namespace ZeroTier { Membership::Membership() : _lastUpdatedMulticast(0), - _lastPushedCom(0), _comRevocationThreshold(0), _revocations(4), _remoteTags(4), _remoteCaps(4), _remoteCoos(4) { - resetPushState(); } -void Membership::pushCredentials(const RuntimeEnvironment *RR,void *tPtr,const int64_t now,const Address &peerAddress,const NetworkConfig &nconf,int localCapabilityIndex,const bool force) +void Membership::pushCredentials(const RuntimeEnvironment *RR,void *tPtr,const int64_t now,const Address &peerAddress,const NetworkConfig &nconf,int localCapabilityIndex) { - bool sendCom = ( (nconf.com) && ( ((now - _lastPushedCom) >= ZT_CREDENTIAL_PUSH_EVERY) || (force) ) ); - - const Capability *sendCap; - if (localCapabilityIndex >= 0) { - sendCap = &(nconf.capabilities[localCapabilityIndex]); - if ( ((now - _localCredLastPushed.cap[localCapabilityIndex]) >= ZT_CREDENTIAL_PUSH_EVERY) || (force) ) - _localCredLastPushed.cap[localCapabilityIndex] = now; - else sendCap = (const Capability *)0; - } else sendCap = (const Capability *)0; + const Capability *sendCap = (localCapabilityIndex >= 0) ? &(nconf.capabilities[localCapabilityIndex]) : (const Capability *)0; const Tag *sendTags[ZT_MAX_NETWORK_TAGS]; unsigned int sendTagCount = 0; - for(unsigned int t=0;t= ZT_CREDENTIAL_PUSH_EVERY) || (force) ) { - _localCredLastPushed.tag[t] = now; - sendTags[sendTagCount++] = &(nconf.tags[t]); - } - } + for(unsigned int t=0;t= ZT_CREDENTIAL_PUSH_EVERY) || (force) ) { - _localCredLastPushed.coo[c] = now; - sendCoos[sendCooCount++] = &(nconf.certificatesOfOwnership[c]); - } - } + for(unsigned int c=0;cidentity.address(),Packet::VERB_NETWORK_CREDENTIALS); if (sendCom) { sendCom = false; nconf.com.serialize(outp); - _lastPushedCom = now; } outp.append((uint8_t)0x00); -- cgit v1.2.3