diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-02 13:55:33 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-02 13:55:33 -0700 |
commit | 412979ba8f0e1776648727765126c210683e038d (patch) | |
tree | ac2294ed0bd9cfbd459c7bea08933dd1ed4e5289 | |
parent | 4f8253dcdb9e6ff2ae18639556811d13729fae2b (diff) | |
download | infinitytier-412979ba8f0e1776648727765126c210683e038d.tar.gz infinitytier-412979ba8f0e1776648727765126c210683e038d.zip |
Attempt to reactivate dead paths.
-rw-r--r-- | node/Peer.hpp | 2 | ||||
-rw-r--r-- | node/Switch.cpp | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/node/Peer.hpp b/node/Peer.hpp index 87aea486..294a4913 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -162,7 +162,7 @@ public: * * @param now Current time * @param inetAddressFamily Keep this address family alive, or 0 to simply pick current best ignoring family - * @return True if at least one direct path seems alive + * @return True if we have at least one direct path */ bool doPingAndKeepalive(uint64_t now,int inetAddressFamily); diff --git a/node/Switch.cpp b/node/Switch.cpp index 125c4b69..472440d1 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -754,7 +754,15 @@ bool Switch::_trySend(const Packet &packet,bool encrypt) const uint64_t now = RR->node->now(); SharedPtr<Path> viaPath(peer->getBestPath(now)); - if ( (!viaPath) || ((!viaPath->alive(now))&&(!RR->topology->isRoot(peer->identity()))) ) { + if ( (viaPath) && (!viaPath->alive(now)) && (!RR->topology->isRoot(peer->identity())) ) { + if ((now - viaPath->lastOut()) > 5000) { + Packet outp(peer->address(),RR->identity.address(),Packet::VERB_ECHO); + outp.armor(peer->key(),true); + viaPath->send(RR,outp.data(),outp.size(),now); + } + viaPath.zero(); + } + if (!viaPath) { SharedPtr<Peer> relay(RR->topology->getBestRoot()); if ( (!relay) || (!(viaPath = relay->getBestPath(now))) ) return false; |