diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-02 11:35:37 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-02 11:35:37 -0700 |
| commit | 49dc47ff38ff27fd8f846a4a6354a60423376671 (patch) | |
| tree | ad07f38721f9b47cfcd488a4f22e117e9f1dd605 /node/Multicaster.cpp | |
| parent | dee86e2448725d4ac592816cac504e5d43fcb026 (diff) | |
| download | infinitytier-49dc47ff38ff27fd8f846a4a6354a60423376671.tar.gz infinitytier-49dc47ff38ff27fd8f846a4a6354a60423376671.zip | |
Make multicast gathering a bit smarter.
Diffstat (limited to 'node/Multicaster.cpp')
| -rw-r--r-- | node/Multicaster.cpp | 46 |
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); } } |
