From d8ce1f7914c462f4731ba009520d3cc526dfcc12 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 13 Aug 2019 12:41:30 -0700 Subject: [PATCH] Added ZT_DIRECT_PATH_PUSH_INTERVAL_MULTIPATH to decrease link aggregation time --- node/Constants.hpp | 9 +++++++++ node/Peer.cpp | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/node/Constants.hpp b/node/Constants.hpp index d58e408f3..16be0c206 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -546,6 +546,15 @@ */ #define ZT_DIRECT_PATH_PUSH_INTERVAL_HAVEPATH 120000 +/** + * Interval between direct path pushes in milliseconds if we are currently in multipath + * mode. In this mode the distinction between ZT_DIRECT_PATH_PUSH_INTERVAL and + * ZT_DIRECT_PATH_PUSH_INTERVAL_HAVEPATH does not exist since we want to inform other + * peers of this peer's new link/address as soon as possible so that both peers can + * begin forming an aggregated link. + */ +#define ZT_DIRECT_PATH_PUSH_INTERVAL_MULTIPATH ZT_DIRECT_PATH_PUSH_INTERVAL_HAVEPATH / 16 + /** * Time horizon for push direct paths cutoff */ diff --git a/node/Peer.cpp b/node/Peer.cpp index 838136968..a7c8bf1af 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -210,7 +210,8 @@ void Peer::received( // is done less frequently. if (this->trustEstablished(now)) { const int64_t sinceLastPush = now - _lastDirectPathPushSent; - if (sinceLastPush >= ((hops == 0) ? ZT_DIRECT_PATH_PUSH_INTERVAL_HAVEPATH : ZT_DIRECT_PATH_PUSH_INTERVAL)) { + if (sinceLastPush >= ((hops == 0) ? ZT_DIRECT_PATH_PUSH_INTERVAL_HAVEPATH : ZT_DIRECT_PATH_PUSH_INTERVAL) + || (_canUseMultipath && (sinceLastPush >= (ZT_DIRECT_PATH_PUSH_INTERVAL_MULTIPATH)))) { _lastDirectPathPushSent = now; std::vector pathsToPush(RR->node->directPaths()); if (pathsToPush.size() > 0) {