mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
Eliminate another check in cluster frontplane mode.
This commit is contained in:
parent
29ec7bf3a2
commit
62a705af1c
1 changed files with 16 additions and 8 deletions
|
@ -105,7 +105,13 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
const Address destination(fragment.destination());
|
const Address destination(fragment.destination());
|
||||||
|
|
||||||
if (destination != RR->identity.address()) {
|
if (destination != RR->identity.address()) {
|
||||||
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) )
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
const bool isClusterFrontplane = ((RR->cluster)&&(RR->cluster->isClusterPeerFrontplane(fromAddr)));
|
||||||
|
#else
|
||||||
|
const bool isClusterFrontplane = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) && (!isClusterFrontplane) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fragment.hops() < ZT_RELAY_MAX_HOPS) {
|
if (fragment.hops() < ZT_RELAY_MAX_HOPS) {
|
||||||
|
@ -116,7 +122,7 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
||||||
if ((!relayTo)||(!relayTo->sendDirect(fragment.data(),fragment.size(),now,false))) {
|
if ((!relayTo)||(!relayTo->sendDirect(fragment.data(),fragment.size(),now,false))) {
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
if (RR->cluster) {
|
if ((RR->cluster)&&(!isClusterFrontplane)) {
|
||||||
RR->cluster->relayViaCluster(Address(),destination,fragment.data(),fragment.size(),false);
|
RR->cluster->relayViaCluster(Address(),destination,fragment.data(),fragment.size(),false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +214,7 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (destination != RR->identity.address()) {
|
if (destination != RR->identity.address()) {
|
||||||
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) )
|
if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) && (source != RR->identity.address()) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Packet packet(data,len);
|
Packet packet(data,len);
|
||||||
|
@ -223,11 +229,13 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
|
||||||
|
|
||||||
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
|
||||||
if ((relayTo)&&((relayTo->sendDirect(packet.data(),packet.size(),now,false)))) {
|
if ((relayTo)&&((relayTo->sendDirect(packet.data(),packet.size(),now,false)))) {
|
||||||
Mutex::Lock _l(_lastUniteAttempt_m);
|
if (source != RR->identity.address()) {
|
||||||
uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
|
Mutex::Lock _l(_lastUniteAttempt_m);
|
||||||
if ((now - luts) >= ZT_MIN_UNITE_INTERVAL) {
|
uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
|
||||||
luts = now;
|
if ((now - luts) >= ZT_MIN_UNITE_INTERVAL) {
|
||||||
_unite(source,destination);
|
luts = now;
|
||||||
|
_unite(source,destination);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
|
|
Loading…
Add table
Reference in a new issue