summaryrefslogtreecommitdiff
path: root/node/Peer.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 14:25:28 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-09 14:25:28 -0800
commit35c4e28f314881f3f6647deaaaf3e58d2ccb5417 (patch)
tree5c9a2a65766b088aecb1d56b9867e89b1afb305b /node/Peer.cpp
parent47424df417dcbeec9e6415a85176299604b0fde2 (diff)
downloadinfinitytier-35c4e28f314881f3f6647deaaaf3e58d2ccb5417.tar.gz
infinitytier-35c4e28f314881f3f6647deaaaf3e58d2ccb5417.zip
Mark geo-redirected paths as suboptimal and do not report that we have a peer if all we have is one of these. Also a few other small fixes.
Diffstat (limited to 'node/Peer.cpp')
-rw-r--r--node/Peer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 6f987da2..0e90b17d 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -83,6 +83,7 @@ void Peer::received(
Packet::Verb inReVerb)
{
#ifdef ZT_ENABLE_CLUSTER
+ bool suboptimalPath = false;
if ((RR->cluster)&&(hops == 0)) {
// Note: findBetterEndpoint() is first since we still want to check
// for a better endpoint even if we don't actually send a redirect.
@@ -124,6 +125,7 @@ void Peer::received(
RR->antiRec->logOutgoingZT(outp.data(),outp.size());
RR->node->putPacket(localAddr,remoteAddr,outp.data(),outp.size());
}
+ suboptimalPath = true;
}
}
#endif
@@ -151,6 +153,9 @@ void Peer::received(
for(unsigned int p=0;p<np;++p) {
if ((_paths[p].address() == remoteAddr)&&(_paths[p].localAddress() == localAddr)) {
_paths[p].received(now);
+#ifdef ZT_ENABLE_CLUSTER
+ _paths[p].setClusterSuboptimal(suboptimalPath);
+#endif
pathIsConfirmed = true;
break;
}
@@ -174,6 +179,9 @@ void Peer::received(
if (slot) {
*slot = Path(localAddr,remoteAddr);
slot->received(now);
+#ifdef ZT_ENABLE_CLUSTER
+ slot->setClusterSuboptimal(suboptimalPath);
+#endif
_numPaths = np;
pathIsConfirmed = true;
_sortPaths(now);