summaryrefslogtreecommitdiff
path: root/node/Multicaster.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-29 16:24:19 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-29 16:24:19 -0700
commit5484cf43098048486418803746e1a15e056a8444 (patch)
treec7ea560158b891ca3b80646a2984e6e3cb0fddb2 /node/Multicaster.cpp
parent22d8aa4dc9e93634f0cc1eb2e13ebafa9e70ea30 (diff)
downloadinfinitytier-5484cf43098048486418803746e1a15e056a8444.tar.gz
infinitytier-5484cf43098048486418803746e1a15e056a8444.zip
More cleanup, and fix a bug in Multicaster::gather()
Diffstat (limited to 'node/Multicaster.cpp')
-rw-r--r--node/Multicaster.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp
index 77e3af7a..aa9fef7b 100644
--- a/node/Multicaster.cpp
+++ b/node/Multicaster.cpp
@@ -74,9 +74,14 @@ unsigned int Multicaster::gather(const Address &queryingPeer,uint64_t nwid,const
if (!limit)
return 0;
- if (limit > 0xffff) // TODO: multiple return packets not yet supported
+ else if (limit > 0xffff)
limit = 0xffff;
+ const unsigned int totalAt = appendTo.size();
+ appendTo.addSize(4); // sizeof(uint32_t)
+ const unsigned int addedAt = appendTo.size();
+ appendTo.addSize(2); // sizeof(uint16_t)
+
{ // Return myself if I am a member of this group
SharedPtr<Network> network(RR->nc->network(nwid));
if ((network)&&(network->subscribedToMulticastGroup(mg))) {
@@ -88,11 +93,6 @@ unsigned int Multicaster::gather(const Address &queryingPeer,uint64_t nwid,const
Mutex::Lock _l(_groups_m);
- const unsigned int totalAt = appendTo.size();
- appendTo.addSize(4); // sizeof(uint32_t)
- const unsigned int addedAt = appendTo.size();
- appendTo.addSize(2); // sizeof(uint16_t)
-
std::map< std::pair<uint64_t,MulticastGroup>,MulticastGroupStatus >::const_iterator gs(_groups.find(std::pair<uint64_t,MulticastGroup>(nwid,mg)));
if ((gs != _groups.end())&&(!gs->second.members.empty())) {
totalKnown += (unsigned int)gs->second.members.size();
@@ -100,7 +100,7 @@ unsigned int Multicaster::gather(const Address &queryingPeer,uint64_t nwid,const
// Members are returned in random order so that repeated gather queries
// will return different subsets of a large multicast group.
k = 0;
- while ((added < limit)&&(k < gs->second.members.size())&&((appendTo.size() + ZT_ADDRESS_LENGTH) <= ZT_PROTO_MAX_PACKET_LENGTH)) {
+ while ((added < limit)&&(k < gs->second.members.size())&&((appendTo.size() + ZT_ADDRESS_LENGTH) <= ZT_UDP_DEFAULT_PAYLOAD_MTU)) {
rptr = (unsigned int)RR->prng->next32();
restart_member_scan: