summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Multicaster.cpp2
-rw-r--r--node/Node.cpp8
-rw-r--r--node/Packet.hpp13
-rw-r--r--node/Switch.cpp10
-rw-r--r--node/Topology.hpp9
5 files changed, 9 insertions, 33 deletions
diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp
index 17649c7b..f8d58501 100644
--- a/node/Multicaster.cpp
+++ b/node/Multicaster.cpp
@@ -229,7 +229,7 @@ void Multicaster::send(
Address explicitGatherPeers[16];
unsigned int numExplicitGatherPeers = 0;
- SharedPtr<Peer> bestRoot(RR->topology->getBestRoot());
+ SharedPtr<Peer> bestRoot(RR->topology->getUpstreamPeer());
if (bestRoot)
explicitGatherPeers[numExplicitGatherPeers++] = bestRoot->address();
explicitGatherPeers[numExplicitGatherPeers++] = Network::controllerFor(nwid);
diff --git a/node/Node.cpp b/node/Node.cpp
index c05a1850..add3117e 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -211,8 +211,7 @@ public:
}
if (upstream) {
- // "Upstream" devices are roots and relays and get special treatment -- they stay alive
- // forever and we try to keep (if available) both IPv4 and IPv6 channels open to them.
+ // We keep connections to upstream peers alive forever.
bool needToContactIndirect = true;
if (p->doPingAndKeepalive(_now,AF_INET)) {
needToContactIndirect = false;
@@ -231,11 +230,8 @@ public:
}
}
+ // If we don't have a direct path or a static endpoint, send something indirectly to find one.
if (needToContactIndirect) {
- // If this is an upstream and we have no stable endpoint for either IPv4 or IPv6,
- // send a NOP indirectly if possible to see if we can get to this peer in any
- // way whatsoever. This will e.g. find network preferred relays that lack
- // stable endpoints by using root servers.
Packet outp(p->address(),RR->identity.address(),Packet::VERB_NOP);
RR->sw->send(outp,true);
}
diff --git a/node/Packet.hpp b/node/Packet.hpp
index 7a742aad..8ff817aa 100644
--- a/node/Packet.hpp
+++ b/node/Packet.hpp
@@ -1049,18 +1049,7 @@ public:
* OK or ERROR and has no special semantics outside of whatever the user
* (via the ZeroTier core API) chooses to give it.
*/
- VERB_USER_MESSAGE = 0x14,
-
- /**
- * Information related to federation and mesh-like behavior:
- * <[2] 16-bit length of Dictionary>
- * <[...] topology definition info Dictionary>
- *
- * This message can carry information that can be used to define topology
- * and implement "mesh-like" behavior. It can optionally generate OK or
- * ERROR, and these carry the same payload.
- */
- VERB_TOPOLOGY_HINT = 0x15
+ VERB_USER_MESSAGE = 0x14
};
/**
diff --git a/node/Switch.cpp b/node/Switch.cpp
index 82b13483..7400fd62 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -131,8 +131,8 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
}
#endif
- // Don't know peer or no direct path -- so relay via root server
- relayTo = RR->topology->getBestRoot();
+ // Don't know peer or no direct path -- so relay via someone upstream
+ relayTo = RR->topology->getUpstreamPeer();
if (relayTo)
relayTo->sendDirect(fragment.data(),fragment.size(),now,true);
}
@@ -254,7 +254,7 @@ void Switch::onRemotePacket(const InetAddress &localAddr,const InetAddress &from
return;
}
#endif
- relayTo = RR->topology->getBestRoot(&source,1,true);
+ relayTo = RR->topology->getUpstreamPeer(&source,1,true);
if (relayTo)
relayTo->sendDirect(packet.data(),packet.size(),now,true);
}
@@ -763,7 +763,7 @@ unsigned long Switch::doTimerTasks(uint64_t now)
Address Switch::_sendWhoisRequest(const Address &addr,const Address *peersAlreadyConsulted,unsigned int numPeersAlreadyConsulted)
{
- SharedPtr<Peer> upstream(RR->topology->getBestRoot(peersAlreadyConsulted,numPeersAlreadyConsulted,false));
+ SharedPtr<Peer> upstream(RR->topology->getUpstreamPeer(peersAlreadyConsulted,numPeersAlreadyConsulted,false));
if (upstream) {
Packet outp(upstream->address(),RR->identity.address(),Packet::VERB_WHOIS);
addr.appendTo(outp);
@@ -793,7 +793,7 @@ bool Switch::_trySend(const Packet &packet,bool encrypt)
viaPath.zero();
}
if (!viaPath) {
- SharedPtr<Peer> relay(RR->topology->getBestRoot());
+ SharedPtr<Peer> relay(RR->topology->getUpstreamPeer());
if ( (!relay) || (!(viaPath = relay->getBestPath(now,false))) ) {
if (!(viaPath = peer->getBestPath(now,true)))
return false;
diff --git a/node/Topology.hpp b/node/Topology.hpp
index 573d5ca2..8e1d28cb 100644
--- a/node/Topology.hpp
+++ b/node/Topology.hpp
@@ -164,15 +164,6 @@ public:
void setUpstream(const Address &a,bool upstream);
/**
- * @return Vector of root server addresses
- */
- inline std::vector<Address> rootAddresses() const
- {
- Mutex::Lock _l(_lock);
- return _rootAddresses;
- }
-
- /**
* @return Vector of active upstream addresses (including roots)
*/
inline std::vector<Address> upstreamAddresses() const