summaryrefslogtreecommitdiff
path: root/node/Multicaster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Multicaster.cpp')
-rw-r--r--node/Multicaster.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp
index a3e600d9..8e3e3e29 100644
--- a/node/Multicaster.cpp
+++ b/node/Multicaster.cpp
@@ -107,7 +107,6 @@ restart_member_scan:
void Multicaster::send(
const CertificateOfMembership *com,
unsigned int limit,
- unsigned int gatherLimit,
uint64_t now,
uint64_t nwid,
const MulticastGroup &mg,
@@ -129,7 +128,7 @@ void Multicaster::send(
nwid,
com,
limit,
- gatherLimit,
+ 0,
src,
mg,
etherType,
@@ -143,25 +142,7 @@ void Multicaster::send(
break;
}
} else {
- // If we don't already have enough members, send to the ones we have and then gather (if allowed within gather rate limit delay)
- gs.txQueue.push_back(OutboundMulticast());
- OutboundMulticast &out = gs.txQueue.back();
-
- out.init(
- now,
- RR->identity.address(),
- nwid,
- com,
- limit,
- gatherLimit,
- src,
- mg,
- etherType,
- data,
- len);
-
- for(std::vector<MulticastGroupMember>::const_reverse_iterator m(gs.members.rbegin());m!=gs.members.rend();++m)
- out.sendAndLog(*(RR->sw),m->address);
+ unsigned int gatherLimit = (limit - (unsigned int)gs.members.size()) + 1;
if ((now - gs.lastExplicitGather) >= ZT_MULTICAST_GATHER_DELAY) {
gs.lastExplicitGather = now;
@@ -178,11 +159,32 @@ void Multicaster::send(
outp.append((uint8_t)0);
mg.mac().appendTo(outp);
outp.append((uint32_t)mg.adi());
- outp.append((uint32_t)((limit - (unsigned int)gs.members.size()) + 1)); // +1 just means we'll have an extra in the queue if available
+ outp.append((uint32_t)gatherLimit); // +1 just means we'll have an extra in the queue if available
outp.armor(sn->key(),true);
sn->send(RR,outp.data(),outp.size(),now);
}
+
+ gatherLimit = 0; // once we've done this we don't need to do it implicitly
}
+
+ gs.txQueue.push_back(OutboundMulticast());
+ OutboundMulticast &out = gs.txQueue.back();
+
+ out.init(
+ now,
+ RR->identity.address(),
+ nwid,
+ com,
+ limit,
+ gatherLimit,
+ src,
+ mg,
+ etherType,
+ data,
+ len);
+
+ for(std::vector<MulticastGroupMember>::const_reverse_iterator m(gs.members.rbegin());m!=gs.members.rend();++m)
+ out.sendAndLog(*(RR->sw),m->address);
}
}