From 3443b203e4035104071f5af0143591dcd48a4974 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 1 Oct 2013 16:01:36 -0400 Subject: Each peer now tracks the last time it announced multicast LIKEs independently and does so frequently enough to prevent expires. Also add a multicast debug facility for use on the testnet. --- node/Node.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'node/Node.cpp') diff --git a/node/Node.cpp b/node/Node.cpp index 954f4cba..ef0598de 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -425,7 +425,6 @@ Node::ReasonForTermination Node::run() uint64_t lastNetworkFingerprintCheck = 0; uint64_t networkConfigurationFingerprint = _r->sysEnv->getNetworkConfigurationFingerprint(); uint64_t lastMulticastCheck = 0; - uint64_t lastMulticastAnnounceAll = 0; long lastDelayDelta = 0; while (impl->reasonForTermination == NODE_RUNNING) { @@ -468,27 +467,15 @@ Node::ReasonForTermination Node::run() // those changes to peers. if ((resynchronize)||((now - lastMulticastCheck) >= ZT_MULTICAST_LOCAL_POLL_PERIOD)) { lastMulticastCheck = now; - bool announceAll = ((resynchronize)||((now - lastMulticastAnnounceAll) >= ZT_MULTICAST_LIKE_ANNOUNCE_ALL_PERIOD)); try { std::map< SharedPtr,std::set > toAnnounce; - { - std::vector< SharedPtr > networks(_r->nc->networks()); - for(std::vector< SharedPtr >::const_iterator nw(networks.begin());nw!=networks.end();++nw) { - if (((*nw)->updateMulticastGroups())||(announceAll)) - toAnnounce.insert(std::pair< SharedPtr,std::set >(*nw,(*nw)->multicastGroups())); - } + std::vector< SharedPtr > networks(_r->nc->networks()); + for(std::vector< SharedPtr >::const_iterator nw(networks.begin());nw!=networks.end();++nw) { + if ((*nw)->updateMulticastGroups()) + toAnnounce.insert(std::pair< SharedPtr,std::set >(*nw,(*nw)->multicastGroups())); } - - if (toAnnounce.size()) { + if (toAnnounce.size()) _r->sw->announceMulticastGroups(toAnnounce); - - // Only update lastMulticastAnnounceAll if we've announced something. This keeps - // the announceAll condition true during startup when there are no multicast - // groups until there is at least one. Technically this shouldn't be required as - // updateMulticastGroups() should return true on any change, but why not? - if (announceAll) - lastMulticastAnnounceAll = now; - } } catch (std::exception &exc) { LOG("unexpected exception announcing multicast groups: %s",exc.what()); } catch ( ... ) { -- cgit v1.2.3