From 9e28bbfbb2671f71527e76dd20fe4a659109ad4b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 10 Jul 2013 17:24:27 -0400 Subject: Factored out multicast propagation algorithm from Switch and Topology, also cleaned up and clarified it a bit. --- node/Switch.hpp | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'node/Switch.hpp') diff --git a/node/Switch.hpp b/node/Switch.hpp index d0fbf02b..a6c753fb 100644 --- a/node/Switch.hpp +++ b/node/Switch.hpp @@ -44,6 +44,7 @@ #include "Network.hpp" #include "SharedPtr.hpp" #include "Demarc.hpp" +#include "Multicaster.hpp" namespace ZeroTier { @@ -171,7 +172,7 @@ private: static void _CBaddPeerFromHello(void *arg,const SharedPtr &p,Topology::PeerVerifyResult result); static void _CBaddPeerFromWhois(void *arg,const SharedPtr &p,Topology::PeerVerifyResult result); // arg == this - void _propagateMulticast(const SharedPtr &network,const Address &upstream,unsigned char *bloom,const MulticastGroup &mg,unsigned int mcHops,unsigned int mcLoadFactor,const MAC &from,unsigned int etherType,const void *data,unsigned int len); + void _propagateMulticast(const SharedPtr &network,const Address &upstream,const unsigned char *bloom,const MulticastGroup &mg,unsigned int mcHops,const MAC &from,unsigned int etherType,const void *data,unsigned int len); PacketServiceAttemptResult _tryHandleRemotePacket(Demarc::Port localPort,const InetAddress &fromAddr,Packet &packet); void _doHELLO(Demarc::Port localPort,const InetAddress &fromAddr,Packet &packet); void _requestWhois(const Address &addr); @@ -179,39 +180,9 @@ private: PacketServiceAttemptResult _trySend(const Packet &packet,bool encrypt); void _retryPendingFor(const Address &addr); - // Updates entry for crc in multicast history, returns true if already - // present in history and not expired. - inline bool _checkAndUpdateMulticastHistory(const MAC &fromMac,const MAC &toMulticastMac,const void *payload,unsigned int len,const uint64_t nwid,const uint64_t now) - { - uint64_t crc = Utils::crc64(0,fromMac.data,6); - crc = Utils::crc64(crc,toMulticastMac.data,6); - crc = Utils::crc64(crc,payload,len); - crc += nwid; // also include network ID - - uint64_t earliest = 0xffffffffffffffffULL; - unsigned long earliestIdx = 0; - for(unsigned int i=0;i