From 88bdb81791e7879c6c199d6e9d03a326ec786484 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 30 Jun 2014 11:31:04 -0700 Subject: Keep track of basic aliveness for peers regardless if direct or indirect connectivity and use this for multicast propagation. Also consolidate adding of active bridges via the same functor as regular multicast next hops. --- node/Switch.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'node/Switch.cpp') diff --git a/node/Switch.cpp b/node/Switch.cpp index 46fb0b49..9b0e3e6e 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -164,26 +164,26 @@ void Switch::onLocalEthernet(const SharedPtr &network,const MAC &from,c memset(bloom,0,sizeof(bloom)); unsigned char *fifoPtr = fifo; - // All multicasts visit all active bridges first -- this is one of the two active/passive bridge differences + // Add all active bridges and then next hops we know about to propagation queue + Multicaster::AddToPropagationQueue appender( + &fifoPtr, + fifoEnd, + bloom, + bloomNonce, + _r->identity.address(), + nconf->multicastPrefixBits(), + prefix, + _r->topology, + now); for(std::set
::const_iterator ab(nconf->activeBridges().begin());ab!=nconf->activeBridges().end();++ab) { - if ((*ab != _r->identity.address())&&(ab->withinMulticastPropagationPrefix(prefix,nconf->multicastPrefixBits()))) { - SharedPtr abPeer(_r->topology->getPeer(*ab)); - if ((abPeer)&&(abPeer->hasActiveDirectPath(now))) { - ab->copyTo(fifoPtr,ZT_ADDRESS_LENGTH); - if ((fifoPtr += ZT_ADDRESS_LENGTH) == fifoEnd) - break; - } - } + if (!appender(*ab)) + break; } + _r->mc->getNextHops(network->id(),mg,appender); - // Then visit next hops according to multicaster (if there's room... almost certainly will be) - if (fifoPtr != fifoEnd) { - _r->mc->getNextHops(network->id(),mg,Multicaster::AddToPropagationQueue(&fifoPtr,fifoEnd,bloom,bloomNonce,_r->identity.address(),nconf->multicastPrefixBits(),prefix)); - - // Pad remainder of FIFO with zeroes - while (fifoPtr != fifoEnd) - *(fifoPtr++) = (unsigned char)0; - } + // Pad remainder of FIFO with zeroes + while (fifoPtr != fifoEnd) + *(fifoPtr++) = (unsigned char)0; // First element in FIFO is first hop, rest of FIFO is sent in packet *to* first hop Address firstHop(fifo,ZT_ADDRESS_LENGTH); -- cgit v1.2.3