diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-06-30 11:31:04 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-06-30 11:31:04 -0700 |
| commit | 88bdb81791e7879c6c199d6e9d03a326ec786484 (patch) | |
| tree | c22c9e36e803ba820c55ca04a82ba204ff906ade /node/Switch.cpp | |
| parent | 458f6ae7c37c7877a842e7931edc67d9fed201cd (diff) | |
| download | infinitytier-88bdb81791e7879c6c199d6e9d03a326ec786484.tar.gz infinitytier-88bdb81791e7879c6c199d6e9d03a326ec786484.zip | |
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.
Diffstat (limited to 'node/Switch.cpp')
| -rw-r--r-- | node/Switch.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
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> &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<Address>::const_iterator ab(nconf->activeBridges().begin());ab!=nconf->activeBridges().end();++ab) { - if ((*ab != _r->identity.address())&&(ab->withinMulticastPropagationPrefix(prefix,nconf->multicastPrefixBits()))) { - SharedPtr<Peer> 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); |
