diff --git a/include/llarp/service/endpoint.hpp b/include/llarp/service/endpoint.hpp index f24df0bcc..c47083070 100644 --- a/include/llarp/service/endpoint.hpp +++ b/include/llarp/service/endpoint.hpp @@ -191,8 +191,8 @@ namespace llarp uint64_t sequenceNo = 0; llarp_time_t lastGoodSend = 0; llarp_time_t createdAt; - llarp_time_t sendTimeout = 20 * 1000; - llarp_time_t connectTimeout = 30 * 1000; + llarp_time_t sendTimeout = 40 * 1000; + llarp_time_t connectTimeout = 60 * 1000; bool markedBad = false; virtual bool diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 949c39471..c574c29f9 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -750,8 +750,6 @@ namespace llarp if(MarkCurrentIntroBad(llarp_time_now_ms())) llarp::LogInfo(Name(), " switched intros to ", remoteIntro.router, " via ", remoteIntro.pathID); - else - UpdateIntroSet(); } return true; } @@ -890,7 +888,7 @@ namespace llarp Endpoint::OutboundContext::OutboundContext(const IntroSet& intro, Endpoint* parent) - : path::Builder(parent->m_Router, parent->m_Router->dht, 2, 4) + : path::Builder(parent->m_Router, parent->m_Router->dht, 3, 4) , SendContext(intro.A, {}, this, parent) , currentIntroSet(intro) @@ -1040,6 +1038,18 @@ namespace llarp if(now - lastShift < MIN_SHIFT_INTERVAL) return false; bool shifted = false; + // to find a intro on the same router as before + for(const auto& intro : currentIntroSet.I) + { + if(intro.ExpiresSoon(now)) + continue; + if(m_BadIntros.find(intro) == m_BadIntros.end() + && remoteIntro.router == intro.router) + { + remoteIntro = intro; + return true; + } + } for(const auto& intro : currentIntroSet.I) { m_Endpoint->EnsureRouterIsKnown(intro.router); @@ -1369,12 +1379,7 @@ namespace llarp if(remoteIntro.ExpiresSoon(now)) { // shift intro - if(!MarkCurrentIntroBad(now)) - { - UpdateIntroSet(); - llarp::LogError("dropping message, no path after shifting intros"); - return; - } + MarkCurrentIntroBad(now); } auto path = m_PathSet->GetNewestPathByRouter(remoteIntro.router);