From e1882b614b48bf0c2a68223b3ee2fb338dbcb8f6 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 1 Oct 2014 14:05:25 -0700 Subject: Some cleanup, Multicaster now sends multicasts as it gets additional members. --- node/OutboundMulticast.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'node/OutboundMulticast.hpp') diff --git a/node/OutboundMulticast.hpp b/node/OutboundMulticast.hpp index 8d717fc1..548171ab 100644 --- a/node/OutboundMulticast.hpp +++ b/node/OutboundMulticast.hpp @@ -66,6 +66,7 @@ public: * @param self My ZeroTier address * @param nwid Network ID * @param com Certificate of membership to attach or NULL to omit + * @param limit Multicast limit for desired number of packets to send * @param gatherLimit Number to lazily/implicitly gather with this frame or 0 for none * @param src Source MAC address of frame * @param dest Destination multicast group (MAC + ADI) @@ -79,6 +80,7 @@ public: const Address &self, uint64_t nwid, const CertificateOfMembership *com, + unsigned int limit, unsigned int gatherLimit, const MAC &src, const MulticastGroup &dest, @@ -98,9 +100,9 @@ public: inline bool expired(uint64_t now) const throw() { return ((now - _timestamp) >= ZT_MULTICAST_TRANSMIT_TIMEOUT); } /** - * @return Number of unique recipients to which this packet has already been sent + * @return True if this outbound multicast has been sent to enough peers */ - inline unsigned int sentToCount() const throw() { return (unsigned int)_alreadySentTo.size(); } + inline bool atLimit() const throw() { return (_alreadySentTo.size() > _limit); } /** * Just send without checking log @@ -144,6 +146,7 @@ private: uint64_t _nwid; MAC _source; MulticastGroup _destination; + unsigned int _limit; unsigned int _etherType; Packet _packet; // packet contains basic structure of MULTICAST_FRAME and payload, is re-used with new IV and addressing each time std::vector
_alreadySentTo; -- cgit v1.2.3