summaryrefslogtreecommitdiff
path: root/node/Cluster.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-27 12:01:00 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-27 12:01:00 -0700
commita1a0ee4edb0933c9b82abad8715def6a63049658 (patch)
treed9f2f31627756c243538c0e46f61eb27a90e1732 /node/Cluster.cpp
parent54a99d8e32e3ee0aed222069e961d44ddd748399 (diff)
downloadinfinitytier-a1a0ee4edb0933c9b82abad8715def6a63049658.tar.gz
infinitytier-a1a0ee4edb0933c9b82abad8715def6a63049658.zip
Fix infinite loop in Cluster, clean up some stuff elsewhere, and back out rate limiting in PUSH_DIRECT_PATHS for now (but we will do something else to mitigate amplification attacks)
Diffstat (limited to 'node/Cluster.cpp')
-rw-r--r--node/Cluster.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp
index bd455933..eef02bc7 100644
--- a/node/Cluster.cpp
+++ b/node/Cluster.cpp
@@ -239,7 +239,7 @@ void Cluster::handleIncomingStateMessage(const void *msg,unsigned int len)
const MAC mac(dmsg.field(ptr,6),6); ptr += 6;
const uint32_t adi = dmsg.at<uint32_t>(ptr); ptr += 4;
RR->mc->add(RR->node->now(),nwid,MulticastGroup(mac,adi),address);
- TRACE("[%u] %s likes %s/%.8x on %.16llu",(unsigned int)fromMemberId,address.toString().c_str(),mac.toString().c_str(),(unsigned int)adi,nwid);
+ TRACE("[%u] %s likes %s/%.8x on %.16llx",(unsigned int)fromMemberId,address.toString().c_str(),mac.toString().c_str(),(unsigned int)adi,nwid);
} break;
case STATE_MESSAGE_COM: {
@@ -376,11 +376,12 @@ bool Cluster::sendViaCluster(const Address &fromPeerAddress,const Address &toPee
Mutex::Lock _l2(_peerAffinities_m);
std::vector<_PeerAffinity>::iterator i(std::lower_bound(_peerAffinities.begin(),_peerAffinities.end(),_PeerAffinity(toPeerAddress,0,0))); // O(log(n))
while ((i != _peerAffinities.end())&&(i->address() == toPeerAddress)) {
- uint16_t mid = i->clusterMemberId();
+ const uint16_t mid = i->clusterMemberId();
if ((mid != _id)&&(i->timestamp > mostRecentTimestamp)) {
mostRecentTimestamp = i->timestamp;
canHasPeer = mid;
}
+ ++i;
}
}