diff options
author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2014-04-03 14:36:52 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2014-04-03 14:36:52 -0700 |
commit | c96d3ebf8cbcc639c194a69ce9dc299a55e2bfbe (patch) | |
tree | 819060f54c7c2b73ebcf0b3c90ec0fed7abd3d63 /node/Node.cpp | |
parent | b1088a6bd7a3b8c77c596f6b65663648d4c4fdea (diff) | |
download | infinitytier-c96d3ebf8cbcc639c194a69ce9dc299a55e2bfbe.tar.gz infinitytier-c96d3ebf8cbcc639c194a69ce9dc299a55e2bfbe.zip |
Such ping logic. So edge case.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r-- | node/Node.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index f9a0a614..bc01378d 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -536,10 +536,10 @@ Node::ReasonForTermination Node::run() uint64_t lastNetworkAutoconfCheck = Utils::now() - 5000ULL; // check autoconf again after 5s for startup uint64_t lastPingCheck = 0; - uint64_t lastSupernodePing = 0; uint64_t lastClean = Utils::now(); // don't need to do this immediately uint64_t lastNetworkFingerprintCheck = 0; uint64_t lastMulticastCheck = 0; + uint64_t lastSupernodePingCheck = 0; long lastDelayDelta = 0; uint64_t networkConfigurationFingerprint = 0; @@ -592,13 +592,9 @@ Node::ReasonForTermination Node::run() /* Ping supernodes separately, and do so more aggressively if we haven't * heard anything from anyone since our last resynchronize / startup. */ - if ( ((now - lastSupernodePing) >= ZT_PEER_DIRECT_PING_DELAY) || - ((_r->timeOfLastResynchronize > _r->timeOfLastPacketReceived) && ((now - lastSupernodePing) >= ZT_STARTUP_AGGRO)) ) { - lastSupernodePing = now; - std::vector< SharedPtr<Peer> > sns(_r->topology->supernodePeers()); - TRACE("pinging %d supernodes",(int)sns.size()); - for(std::vector< SharedPtr<Peer> >::const_iterator p(sns.begin());p!=sns.end();++p) - (*p)->sendPing(_r,now); + if ((now - lastSupernodePingCheck) >= ZT_STARTUP_AGGRO) { + lastSupernodePingCheck = now; + _r->topology->eachSupernodePeer(Topology::PingSupernodesThatNeedPing(_r,now)); } if (resynchronize) { |