summaryrefslogtreecommitdiff
path: root/node/OutboundMulticast.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-01 14:05:25 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-01 14:05:25 -0700
commite1882b614b48bf0c2a68223b3ee2fb338dbcb8f6 (patch)
tree2447fa648e910c6ef9aa8d4b3147606b2bc18e91 /node/OutboundMulticast.hpp
parentae082c3cb8a1ba7f8efb95ce690b012ffa7a79cd (diff)
downloadinfinitytier-e1882b614b48bf0c2a68223b3ee2fb338dbcb8f6.tar.gz
infinitytier-e1882b614b48bf0c2a68223b3ee2fb338dbcb8f6.zip
Some cleanup, Multicaster now sends multicasts as it gets additional members.
Diffstat (limited to 'node/OutboundMulticast.hpp')
-rw-r--r--node/OutboundMulticast.hpp7
1 files changed, 5 insertions, 2 deletions
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<Address> _alreadySentTo;