summaryrefslogtreecommitdiff
path: root/node/Switch.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 12:51:52 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-02-01 12:51:52 -0800
commite778d45128295ddf9bbb00f4a46f103de4bc4c11 (patch)
tree5403c75c376153f4120e8eb22972cdff4eb54c07 /node/Switch.cpp
parent5e11cf637816121f79c3ed00370843e93b62b1c6 (diff)
downloadinfinitytier-e778d45128295ddf9bbb00f4a46f103de4bc4c11.tar.gz
infinitytier-e778d45128295ddf9bbb00f4a46f103de4bc4c11.zip
Still want to send WANT_PEER under two failure modes.
Diffstat (limited to 'node/Switch.cpp')
-rw-r--r--node/Switch.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp
index d4f477f0..6185037d 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -729,24 +729,25 @@ bool Switch::_trySend(Packet &packet,bool encrypt)
#endif
}
} else {
- 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
+#ifdef ZT_ENABLE_CLUSTER
+ if (RR->cluster)
+ clusterMostRecentMemberId = RR->cluster->prepSendViaCluster(destination,clusterPeerSecret);
+ if (clusterMostRecentMemberId < 0) {
+#else
+ requestWhois(destination);
+ 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
}
-#ifdef ZT_TRACE
#ifdef ZT_ENABLE_CLUSTER
- if ((!viaPath)&&(clusterMostRecentMemberId < 0)) {
- TRACE("BUG: both viaPath and clusterMostRecentMemberId ended up invalid in Switch::_trySend()!");
- abort();
- }
+ if ((!viaPath)&&(clusterMostRecentMemberId < 0))
+ return false;
#else
- if (!viaPath) {
- TRACE("BUG: viaPath ended up NULL in Switch::_trySend()!");
- abort();
- }
-#endif
+ if (!viaPath)
+ return false;
#endif
unsigned int chunkSize = std::min(packet.size(),(unsigned int)ZT_UDP_DEFAULT_PAYLOAD_MTU);