Keep attemting to upgrade direct path if path is not private to facilitate better use of LANs and backplane networks.

This commit is contained in:
Adam Ierymenko 2017-09-14 20:56:50 -07:00
parent f8014413a3
commit 52916eebcf

View File

@ -194,8 +194,12 @@ void Peer::received(
} }
} }
} }
} else if (this->trustEstablished(now)) { }
// Send PUSH_DIRECT_PATHS if hops>0 (relayed) and we have a trust relationship (common network membership)
// If we are being relayed or if we're using a global address, send PUSH_DIRECT_PATHS.
// In the global address case we push only configured direct paths to accomplish
// fall-forward to local backplane networks over e.g. LAN or Amazon VPC.
if ( ((hops > 0)||(path->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) && (this->trustEstablished(now)) ) {
if ((now - _lastDirectPathPushSent) >= ZT_DIRECT_PATH_PUSH_INTERVAL) { if ((now - _lastDirectPathPushSent) >= ZT_DIRECT_PATH_PUSH_INTERVAL) {
_lastDirectPathPushSent = now; _lastDirectPathPushSent = now;
@ -205,6 +209,7 @@ void Peer::received(
for(std::vector<InetAddress>::const_iterator i(dps.begin());i!=dps.end();++i) for(std::vector<InetAddress>::const_iterator i(dps.begin());i!=dps.end();++i)
pathsToPush.push_back(*i); pathsToPush.push_back(*i);
if (hops > 0) {
std::vector<InetAddress> sym(RR->sa->getSymmetricNatPredictions()); std::vector<InetAddress> sym(RR->sa->getSymmetricNatPredictions());
for(unsigned long i=0,added=0;i<sym.size();++i) { for(unsigned long i=0,added=0;i<sym.size();++i) {
InetAddress tmp(sym[(unsigned long)RR->node->prng() % sym.size()]); InetAddress tmp(sym[(unsigned long)RR->node->prng() % sym.size()]);
@ -214,6 +219,7 @@ void Peer::received(
break; break;
} }
} }
}
if (pathsToPush.size() > 0) { if (pathsToPush.size() > 0) {
std::vector<InetAddress>::const_iterator p(pathsToPush.begin()); std::vector<InetAddress>::const_iterator p(pathsToPush.begin());