diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-17 14:55:33 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-17 14:55:33 -0700 |
commit | aa831dd843f21c092e99cbdd37496b2c668f4598 (patch) | |
tree | 2de874dcb58536576fed21b351fe029b8b07cee0 /node | |
parent | 2dc783214c25cdba80b2188e91a973cc8968aee4 (diff) | |
download | infinitytier-aa831dd843f21c092e99cbdd37496b2c668f4598.tar.gz infinitytier-aa831dd843f21c092e99cbdd37496b2c668f4598.zip |
More stack->heap...
Diffstat (limited to 'node')
-rw-r--r-- | node/Network.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index 92b10671..9f78ec68 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -1493,25 +1493,27 @@ void Network::_sendUpdatesToMembers(void *tPtr,const MulticastGroup *const newMu void Network::_announceMulticastGroupsTo(void *tPtr,const Address &peer,const std::vector<MulticastGroup> &allMulticastGroups) { // Assumes _lock is locked - Packet outp(peer,RR->identity.address(),Packet::VERB_MULTICAST_LIKE); + Packet *const outp = new Packet(peer,RR->identity.address(),Packet::VERB_MULTICAST_LIKE); for(std::vector<MulticastGroup>::const_iterator mg(allMulticastGroups.begin());mg!=allMulticastGroups.end();++mg) { - if ((outp.size() + 24) >= ZT_PROTO_MAX_PACKET_LENGTH) { - outp.compress(); - RR->sw->send(tPtr,outp,true); - outp.reset(peer,RR->identity.address(),Packet::VERB_MULTICAST_LIKE); + if ((outp->size() + 24) >= ZT_PROTO_MAX_PACKET_LENGTH) { + outp->compress(); + RR->sw->send(tPtr,*outp,true); + outp->reset(peer,RR->identity.address(),Packet::VERB_MULTICAST_LIKE); } // network ID, MAC, ADI - outp.append((uint64_t)_id); - mg->mac().appendTo(outp); - outp.append((uint32_t)mg->adi()); + outp->append((uint64_t)_id); + mg->mac().appendTo(*outp); + outp->append((uint32_t)mg->adi()); } - if (outp.size() > ZT_PROTO_MIN_PACKET_LENGTH) { - outp.compress(); - RR->sw->send(tPtr,outp,true); + if (outp->size() > ZT_PROTO_MIN_PACKET_LENGTH) { + outp->compress(); + RR->sw->send(tPtr,*outp,true); } + + delete outp; } std::vector<MulticastGroup> Network::_allMulticastGroups() const |