mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Cluster build fix.
This commit is contained in:
parent
48a374c82c
commit
f2d2df2b11
3 changed files with 4 additions and 4 deletions
|
@ -361,7 +361,7 @@ void Cluster::handleIncomingStateMessage(const void *msg,unsigned int len)
|
||||||
case CLUSTER_MESSAGE_WANT_PEER: {
|
case CLUSTER_MESSAGE_WANT_PEER: {
|
||||||
const Address zeroTierAddress(dmsg.field(ptr,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); ptr += ZT_ADDRESS_LENGTH;
|
const Address zeroTierAddress(dmsg.field(ptr,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); ptr += ZT_ADDRESS_LENGTH;
|
||||||
SharedPtr<Peer> peer(RR->topology->getPeerNoCache(zeroTierAddress));
|
SharedPtr<Peer> peer(RR->topology->getPeerNoCache(zeroTierAddress));
|
||||||
if ( (peer) && (peer->hasClusterOptimalPath(RR->node->now())) ) {
|
if ( (peer) && (peer->hasLocalClusterOptimalPath(RR->node->now())) ) {
|
||||||
Buffer<1024> buf;
|
Buffer<1024> buf;
|
||||||
peer->identity().serialize(buf);
|
peer->identity().serialize(buf);
|
||||||
Mutex::Lock _l2(_members[fromMemberId].lock);
|
Mutex::Lock _l2(_members[fromMemberId].lock);
|
||||||
|
|
|
@ -175,7 +175,7 @@ void Peer::received(
|
||||||
_paths[slot].lastReceive = now;
|
_paths[slot].lastReceive = now;
|
||||||
_paths[slot].path = path;
|
_paths[slot].path = path;
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
_paths[p].localClusterSuboptimal = suboptimalPath;
|
_paths[slot].localClusterSuboptimal = suboptimalPath;
|
||||||
if (RR->cluster)
|
if (RR->cluster)
|
||||||
RR->cluster->broadcastHavePeer(_id);
|
RR->cluster->broadcastHavePeer(_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -289,10 +289,10 @@ public:
|
||||||
* @param now Current time
|
* @param now Current time
|
||||||
* @return True if this peer has at least one active direct path that is not cluster-suboptimal
|
* @return True if this peer has at least one active direct path that is not cluster-suboptimal
|
||||||
*/
|
*/
|
||||||
inline bool hasClusterOptimalPath(uint64_t now) const
|
inline bool hasLocalClusterOptimalPath(uint64_t now) const
|
||||||
{
|
{
|
||||||
for(unsigned int p=0,np=_numPaths;p<np;++p) {
|
for(unsigned int p=0,np=_numPaths;p<np;++p) {
|
||||||
if ( (_paths[p].path->alive(now)) && ((_paths[p].clusterWeights & 1) != 0) )
|
if ( (_paths[p].path->alive(now)) && (!_paths[p].localClusterSuboptimal) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue