Wire in redirectPeer(), now about ready to test clustering!

This commit is contained in:
Adam Ierymenko 2015-10-20 17:36:10 -07:00
parent 6a7b47e5e1
commit 978b056a01
3 changed files with 15 additions and 13 deletions

View file

@ -82,6 +82,7 @@ void Peer::received(
{
const uint64_t now = RR->node->now();
bool needMulticastGroupAnnounce = false;
bool pathIsConfirmed = false;
{
Mutex::Lock _l(_lock);
@ -89,8 +90,6 @@ void Peer::received(
_lastReceive = now;
if (!hops) {
bool pathIsConfirmed = false;
/* Learn new paths from direct (hops == 0) packets */
{
unsigned int np = _numPaths;
@ -141,11 +140,6 @@ void Peer::received(
}
}
}
#ifdef ZT_ENABLE_CLUSTER
if ((pathIsConfirmed)&&(RR->cluster))
RR->cluster->replicateHavePeer(_id);
#endif
}
if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) {
@ -159,6 +153,14 @@ void Peer::received(
_lastMulticastFrame = now;
}
#ifdef ZT_ENABLE_CLUSTER
if ((pathIsConfirmed)&&(RR->cluster)) {
// Either shuttle this peer off somewhere else or report to other members that we have it
if (!RR->cluster->redirectPeer(_id.address(),remoteAddr,false))
RR->cluster->replicateHavePeer(_id);
}
#endif
if (needMulticastGroupAnnounce) {
const std::vector< SharedPtr<Network> > networks(RR->node->allNetworks());
for(std::vector< SharedPtr<Network> >::const_iterator n(networks.begin());n!=networks.end();++n)