summaryrefslogtreecommitdiff
path: root/node/Cluster.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 12:32:06 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 12:32:06 -0800
commit5e11cf637816121f79c3ed00370843e93b62b1c6 (patch)
treeb42628c32ef6ef3ac819270b6d65db7c0d8f5364 /node/Cluster.cpp
parent5dbebc513ad67bb65c41c42a9c761c085309564f (diff)
downloadinfinitytier-5e11cf637816121f79c3ed00370843e93b62b1c6.tar.gz
infinitytier-5e11cf637816121f79c3ed00370843e93b62b1c6.zip
Can't armor() a packet until all flags are set.
Diffstat (limited to 'node/Cluster.cpp')
-rw-r--r--node/Cluster.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp
index 16ef040b..a24cf99d 100644
--- a/node/Cluster.cpp
+++ b/node/Cluster.cpp
@@ -516,12 +516,11 @@ void Cluster::broadcastNetworkConfigChunk(const void *chunk,unsigned int len)
}
}
-int Cluster::prepSendViaCluster(const Address &toPeerAddress,Packet &outp,bool encrypt)
+int Cluster::prepSendViaCluster(const Address &toPeerAddress,void *peerSecret)
{
const uint64_t now = RR->node->now();
uint64_t mostRecentTs = 0;
int mostRecentMemberId = -1;
- uint8_t mostRecentSecretKey[ZT_PEER_SECRET_KEY_LENGTH];
{
Mutex::Lock _l2(_remotePeers_m);
std::map< std::pair<Address,unsigned int>,_RemotePeer >::const_iterator rpe(_remotePeers.lower_bound(std::pair<Address,unsigned int>(toPeerAddress,0)));
@@ -530,7 +529,7 @@ int Cluster::prepSendViaCluster(const Address &toPeerAddress,Packet &outp,bool e
break;
else if (rpe->second.lastHavePeerReceived > mostRecentTs) {
mostRecentTs = rpe->second.lastHavePeerReceived;
- memcpy(mostRecentSecretKey,rpe->second.key,ZT_PEER_SECRET_KEY_LENGTH);
+ memcpy(peerSecret,rpe->second.key,ZT_PEER_SECRET_KEY_LENGTH);
mostRecentMemberId = (int)rpe->first.second;
}
++rpe;
@@ -566,7 +565,6 @@ int Cluster::prepSendViaCluster(const Address &toPeerAddress,Packet &outp,bool e
}
}
- outp.armor(mostRecentSecretKey,encrypt);
return mostRecentMemberId;
} else return -1;
}