mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Still want to send WANT_PEER under two failure modes.
This commit is contained in:
parent
5e11cf6378
commit
e778d45128
2 changed files with 37 additions and 38 deletions
|
@ -536,11 +536,10 @@ int Cluster::prepSendViaCluster(const Address &toPeerAddress,void *peerSecret)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mostRecentMemberId >= 0) {
|
|
||||||
const uint64_t ageOfMostRecentHavePeerAnnouncement = now - mostRecentTs;
|
const uint64_t ageOfMostRecentHavePeerAnnouncement = now - mostRecentTs;
|
||||||
if (ageOfMostRecentHavePeerAnnouncement >= (ZT_PEER_ACTIVITY_TIMEOUT / 3)) {
|
if (ageOfMostRecentHavePeerAnnouncement >= (ZT_PEER_ACTIVITY_TIMEOUT / 3)) {
|
||||||
if (ageOfMostRecentHavePeerAnnouncement >= ZT_PEER_ACTIVITY_TIMEOUT)
|
if (ageOfMostRecentHavePeerAnnouncement >= ZT_PEER_ACTIVITY_TIMEOUT)
|
||||||
return -1;
|
mostRecentMemberId = -1;
|
||||||
|
|
||||||
bool sendWantPeer = true;
|
bool sendWantPeer = true;
|
||||||
{
|
{
|
||||||
|
@ -566,7 +565,6 @@ int Cluster::prepSendViaCluster(const Address &toPeerAddress,void *peerSecret)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mostRecentMemberId;
|
return mostRecentMemberId;
|
||||||
} else return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Cluster::sendViaCluster(int mostRecentMemberId,const Address &toPeerAddress,const void *data,unsigned int len)
|
bool Cluster::sendViaCluster(int mostRecentMemberId,const Address &toPeerAddress,const void *data,unsigned int len)
|
||||||
|
|
|
@ -729,24 +729,25 @@ bool Switch::_trySend(Packet &packet,bool encrypt)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
if (RR->cluster)
|
||||||
|
clusterMostRecentMemberId = RR->cluster->prepSendViaCluster(destination,clusterPeerSecret);
|
||||||
|
if (clusterMostRecentMemberId < 0) {
|
||||||
|
#else
|
||||||
requestWhois(destination);
|
requestWhois(destination);
|
||||||
#ifndef ZT_ENABLE_CLUSTER
|
|
||||||
return false; // if we are not in cluster mode, there is no way we can send without knowing the peer directly
|
return false; // if we are not in cluster mode, there is no way we can send without knowing the peer directly
|
||||||
|
#endif
|
||||||
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZT_TRACE
|
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
if ((!viaPath)&&(clusterMostRecentMemberId < 0)) {
|
if ((!viaPath)&&(clusterMostRecentMemberId < 0))
|
||||||
TRACE("BUG: both viaPath and clusterMostRecentMemberId ended up invalid in Switch::_trySend()!");
|
return false;
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (!viaPath) {
|
if (!viaPath)
|
||||||
TRACE("BUG: viaPath ended up NULL in Switch::_trySend()!");
|
return false;
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int chunkSize = std::min(packet.size(),(unsigned int)ZT_UDP_DEFAULT_PAYLOAD_MTU);
|
unsigned int chunkSize = std::min(packet.size(),(unsigned int)ZT_UDP_DEFAULT_PAYLOAD_MTU);
|
||||||
|
|
Loading…
Add table
Reference in a new issue