diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-11-09 10:25:20 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-11-09 10:25:20 -0800 |
commit | b57c855a8c4a1c2a2278bf8e25ba6b82697387cd (patch) | |
tree | f7a86547f1d99f6884256f73cff15f8ae65d82c0 | |
parent | ed954c5ca2daa52c3f2bd7740fb80f87a127c427 (diff) | |
download | infinitytier-b57c855a8c4a1c2a2278bf8e25ba6b82697387cd.tar.gz infinitytier-b57c855a8c4a1c2a2278bf8e25ba6b82697387cd.zip |
PROXY_SEND fix.
-rw-r--r-- | node/Cluster.cpp | 13 | ||||
-rw-r--r-- | node/Cluster.hpp | 4 | ||||
-rw-r--r-- | one.o-2f9cf2a3 | 0 |
3 files changed, 10 insertions, 7 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp index ac8017ca..7244c951 100644 --- a/node/Cluster.cpp +++ b/node/Cluster.cpp @@ -308,7 +308,6 @@ void Cluster::handleIncomingStateMessage(const void *msg,unsigned int len) Buffer<2048> rendezvousForRemote; remotePeerAddress.appendTo(rendezvousForRemote); rendezvousForRemote.append((uint8_t)Packet::VERB_RENDEZVOUS); - const unsigned int rendezvousForOtherEndPayloadSizePtr = rendezvousForRemote.size(); rendezvousForRemote.addSize(2); // space for actual packet payload length rendezvousForRemote.append((uint8_t)0); // flags == 0 localPeerAddress.appendTo(rendezvousForRemote); @@ -324,7 +323,7 @@ void Cluster::handleIncomingStateMessage(const void *msg,unsigned int len) rendezvousForRemote.append((uint16_t)bestLocalV6.port()); rendezvousForRemote.append((uint8_t)16); rendezvousForRemote.append(bestLocalV6.rawIpData(),16); - rendezvousForRemote.setAt<uint16_t>(rendezvousForOtherEndPayloadSizePtr,(uint16_t)(9 + 16)); + rendezvousForRemote.setAt<uint16_t>(ZT_ADDRESS_LENGTH + 1,(uint16_t)(9 + 16)); } else if ((bestLocalV4)&&(bestRemoteV4)) { haveMatch = true; @@ -335,7 +334,7 @@ void Cluster::handleIncomingStateMessage(const void *msg,unsigned int len) rendezvousForRemote.append((uint16_t)bestLocalV4.port()); rendezvousForRemote.append((uint8_t)4); rendezvousForRemote.append(bestLocalV4.rawIpData(),4); - rendezvousForRemote.setAt<uint16_t>(rendezvousForOtherEndPayloadSizePtr,(uint16_t)(9 + 4)); + rendezvousForRemote.setAt<uint16_t>(ZT_ADDRESS_LENGTH + 1,(uint16_t)(9 + 4)); } if (haveMatch) { @@ -749,11 +748,13 @@ void Cluster::_doREMOTE_WHOIS(uint64_t fromMemberId,const Packet &remotep) Buffer<1024> routp; remotep.source().appendTo(routp); routp.append((uint8_t)Packet::VERB_OK); + routp.addSize(2); // space for length routp.append((uint8_t)Packet::VERB_WHOIS); routp.append(remotep.packetId()); queried.serialize(routp); Mutex::Lock _l2(_members[fromMemberId].lock); + routp.setAt<uint16_t>(ZT_ADDRESS_LENGTH + 1,(uint16_t)(routp.size() - ZT_ADDRESS_LENGTH - 3)); _send(fromMemberId,CLUSTER_MESSAGE_PROXY_SEND,routp.data(),routp.size()); _flush(fromMemberId); } @@ -771,15 +772,17 @@ void Cluster::_doREMOTE_MULTICAST_GATHER(uint64_t fromMemberId,const Packet &rem Buffer<ZT_PROTO_MAX_PACKET_LENGTH> routp; remotePeerAddress.appendTo(routp); routp.append((uint8_t)Packet::VERB_OK); + routp.addSize(2); // space for length routp.append((uint8_t)Packet::VERB_MULTICAST_GATHER); routp.append(remotep.packetId()); routp.append(nwid); mg.mac().appendTo(routp); routp.append((uint32_t)mg.adi()); - if (gatherLimit > ((ZT_CLUSTER_MAX_MESSAGE_LENGTH - 64) / 5)) - gatherLimit = ((ZT_CLUSTER_MAX_MESSAGE_LENGTH - 64) / 5); + if (gatherLimit > ((ZT_CLUSTER_MAX_MESSAGE_LENGTH - 80) / 5)) + gatherLimit = ((ZT_CLUSTER_MAX_MESSAGE_LENGTH - 80) / 5); if (RR->mc->gather(remotePeerAddress,nwid,mg,routp,gatherLimit)) { + routp.setAt<uint16_t>(ZT_ADDRESS_LENGTH + 1,(uint16_t)(routp.size() - ZT_ADDRESS_LENGTH - 3)); Mutex::Lock _l2(_members[fromMemberId].lock); _send(fromMemberId,CLUSTER_MESSAGE_PROXY_SEND,routp.data(),routp.size()); } diff --git a/node/Cluster.hpp b/node/Cluster.hpp index e45b2d82..beb5ecdc 100644 --- a/node/Cluster.hpp +++ b/node/Cluster.hpp @@ -58,12 +58,12 @@ /** * Desired period between doPeriodicTasks() in milliseconds */ -#define ZT_CLUSTER_PERIODIC_TASK_PERIOD 250 +#define ZT_CLUSTER_PERIODIC_TASK_PERIOD 100 /** * How often to flush outgoing message queues (maximum interval) */ -#define ZT_CLUSTER_FLUSH_PERIOD 500 +#define ZT_CLUSTER_FLUSH_PERIOD 300 /** * Maximum number of queued outgoing packets per sender address diff --git a/one.o-2f9cf2a3 b/one.o-2f9cf2a3 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/one.o-2f9cf2a3 |