More work in progress in new multicast propagation...
This commit is contained in:
parent
f3128a18fe
commit
24bad9f3d1
9 changed files with 226 additions and 162 deletions
|
@ -52,6 +52,8 @@
|
|||
#include "InetAddress.hpp"
|
||||
#include "BandwidthAccount.hpp"
|
||||
|
||||
#define ZT_NETWORK_MULTICAST_DEDUP_HISTORY_LENGTH 256
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class RuntimeEnvironment;
|
||||
|
@ -583,12 +585,46 @@ public:
|
|||
//return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multicast deduplicator
|
||||
*
|
||||
* This checks to see if a multicast GUID has been seen before. If not, it
|
||||
* adds it to the history and returns false.
|
||||
*
|
||||
* @param mcGuid Multicast GUID (sender address + sender unique ID)
|
||||
* @return True if multicast IS a duplicate, false otherwise
|
||||
*/
|
||||
inline bool multicastDeduplicate(uint64_t mcGuid)
|
||||
throw()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
for(unsigned int i=0;i<ZT_NETWORK_MULTICAST_DEDUP_HISTORY_LENGTH;++i) {
|
||||
if (_multicastHistory[i] == mcGuid)
|
||||
return true;
|
||||
}
|
||||
_multicastHistory[_multicastHistoryPtr++ % ZT_NETWORK_MULTICAST_DEDUP_HISTORY_LENGTH] = mcGuid;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this network allows bridging
|
||||
*/
|
||||
inline bool permitsBridging() const
|
||||
throw()
|
||||
{
|
||||
return false; // TODO: bridging not implemented yet
|
||||
}
|
||||
|
||||
private:
|
||||
static void _CBhandleTapData(void *arg,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data);
|
||||
void _restoreState();
|
||||
|
||||
const RuntimeEnvironment *_r;
|
||||
|
||||
// Ring buffer of most recently injected multicast packet GUIDs
|
||||
uint64_t _multicastHistory[ZT_NETWORK_MULTICAST_DEDUP_HISTORY_LENGTH];
|
||||
unsigned int _multicastHistoryPtr;
|
||||
|
||||
// Multicast bandwidth accounting for peers on this network
|
||||
std::map< std::pair<Address,MulticastGroup>,BandwidthAccount > _multicastRateAccounts;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue