From 14671009f89a881676289defa0e126d4f6f6bb5a Mon Sep 17 00:00:00 2001 From: travisladuke Date: Fri, 4 Aug 2023 16:12:36 -0700 Subject: [PATCH] Don't skip hellos when there are no paths available working on #2082 --- node/Node.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/Node.cpp b/node/Node.cpp index e2d5f7bf3..0657cbd0b 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -248,9 +248,15 @@ public: const std::vector *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; }