summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authortravisladuke <[email protected]>2023-08-04 16:12:36 -0700
committertravisladuke <[email protected]>2023-08-09 09:35:12 -0700
commit14671009f89a881676289defa0e126d4f6f6bb5a (patch)
treedf5e9d48c4594de538f0ba56310ea57ad8485d71 /node
parent0bc10923a1fc0c1ac1058d5ba4044afa01bda474 (diff)
Don't skip hellos when there are no paths available
working on #2082
Diffstat (limited to 'node')
-rw-r--r--node/Node.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index e2d5f7bf..0657cbd0 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -248,9 +248,15 @@ public:
const std::vector<InetAddress> *const alwaysContactEndpoints = _alwaysContact.get(p->address());
if (alwaysContactEndpoints) {
- // Contact upstream peers as infrequently as possible
ZT_PeerRole role = RR->topology->role(p->address());
+
+ // Contact upstream peers as infrequently as possible
int roleBasedTimerScale = (role == ZT_PEER_ROLE_LEAF) ? 2 : 16;
+
+ // Unless we don't any have paths to the roots, then we shouldn't wait a long time to contact them
+ bool hasPaths = p->paths(RR->node->now()).size() > 0;
+ roleBasedTimerScale = (role != ZT_PEER_ROLE_LEAF && !hasPaths) ? 0 : roleBasedTimerScale;
+
if ((RR->node->now() - p->lastSentFullHello()) <= (ZT_PATH_HEARTBEAT_PERIOD * roleBasedTimerScale)) {
return;
}