summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 14:35:07 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 14:35:07 -0800
commit62a705af1c88dd3b6cd40d1d3b1ce5e602a5ad31 (patch)
tree69a80853c7225dac79dad553fc9bed2fbdd0cc8f /node
parent29ec7bf3a2e70fcf3b38a39cf00e8dd7ac9e0818 (diff)
downloadinfinitytier-62a705af1c88dd3b6cd40d1d3b1ce5e602a5ad31.tar.gz
infinitytier-62a705af1c88dd3b6cd40d1d3b1ce5e602a5ad31.zip
Eliminate another check in cluster frontplane mode.
Diffstat (limited to 'node')
-rw-r--r--node/Switch.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp
index cddf0f66..56a15f0a 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -105,7 +105,13 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
const Address destination(fragment.destination());
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;
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);
if ((!relayTo)||(!relayTo->sendDirect(fragment.data(),fragment.size(),now,false))) {
#ifdef ZT_ENABLE_CLUSTER
- if (RR->cluster) {
+ if ((RR->cluster)&&(!isClusterFrontplane)) {
RR->cluster->relayViaCluster(Address(),destination,fragment.data(),fragment.size(),false);
return;
}
@@ -208,7 +214,7 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
#endif
if (destination != RR->identity.address()) {
- if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) )
+ if ( (!RR->topology->amRoot()) && (!path->trustEstablished(now)) && (source != RR->identity.address()) )
return;
Packet packet(data,len);
@@ -223,11 +229,13 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
if ((relayTo)&&((relayTo->sendDirect(packet.data(),packet.size(),now,false)))) {
- Mutex::Lock _l(_lastUniteAttempt_m);
- uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
- if ((now - luts) >= ZT_MIN_UNITE_INTERVAL) {
- luts = now;
- _unite(source,destination);
+ if (source != RR->identity.address()) {
+ Mutex::Lock _l(_lastUniteAttempt_m);
+ uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
+ if ((now - luts) >= ZT_MIN_UNITE_INTERVAL) {
+ luts = now;
+ _unite(source,destination);
+ }
}
} else {
#ifdef ZT_ENABLE_CLUSTER