summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 09:19:03 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 09:19:03 -0800
commitf4d12603e03c88e7c5d83b2419cb9ec17412b928 (patch)
treee2ff1a4f3294954163330820df05720e29a8c9b4 /node
parentff81415ffe86758c300a848f68d4d29ebd4dabc5 (diff)
downloadinfinitytier-f4d12603e03c88e7c5d83b2419cb9ec17412b928.tar.gz
infinitytier-f4d12603e03c88e7c5d83b2419cb9ec17412b928.zip
Tweak how Switch passes off to Cluster on relay to fit new paradigm.
Diffstat (limited to 'node')
-rw-r--r--node/Switch.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp
index 355440a5..7caf8ba6 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -621,8 +621,10 @@ void Switch::_handleRemotePacketFragment(const InetAddress &localAddr,const Inet
SharedPtr<Peer> relayTo = RR->topology->getPeer(destination);
if ((!relayTo)||(!relayTo->send(RR,fragment.data(),fragment.size(),RR->node->now()))) {
#ifdef ZT_ENABLE_CLUSTER
- if ((RR->cluster)&&(RR->cluster->sendViaCluster(Address(),destination,fragment.data(),fragment.size(),false)))
+ if (RR->cluster) {
+ RR->cluster->sendViaCluster(Address(),destination,fragment.data(),fragment.size(),false);
return;
+ }
#endif
// Don't know peer or no direct path -- so relay via root server
@@ -713,14 +715,15 @@ void Switch::_handleRemotePacketHead(const InetAddress &localAddr,const InetAddr
} else {
#ifdef ZT_ENABLE_CLUSTER
if (RR->cluster) {
- Mutex::Lock _l(_lastUniteAttempt_m);
- uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
- const bool shouldUnite = ((now - luts) >= ZT_MIN_UNITE_INTERVAL);
- if (RR->cluster->sendViaCluster(source,destination,packet->data(),packet->size(),shouldUnite)) {
- if (shouldUnite)
- luts = now;
- return;
+ bool shouldUnite;
+ {
+ Mutex::Lock _l(_lastUniteAttempt_m);
+ uint64_t &luts = _lastUniteAttempt[_LastUniteKey(source,destination)];
+ shouldUnite = ((now - luts) >= ZT_MIN_UNITE_INTERVAL);
+ luts = now;
}
+ RR->cluster->sendViaCluster(source,destination,packet->data(),packet->size(),shouldUnite);
+ return;
}
#endif