diff --git a/llarp/link/utp.cpp b/llarp/link/utp.cpp index 3ff337c63..60f4bf8af 100644 --- a/llarp/link/utp.cpp +++ b/llarp/link/utp.cpp @@ -611,9 +611,7 @@ namespace llarp return false; buf.sz = buf.cur - buf.base; buf.cur = buf.base; - if(!this->QueueWriteBuffers(buf)) - return false; - PumpWrite(); + return this->QueueWriteBuffers(buf); } return true; }; @@ -765,6 +763,9 @@ namespace llarp { if(sendq.size() >= MaxSendQueueSize) return false; + // premptive pump + if(sendq.size() >= MaxSendQueueSize / 2) + PumpWrite(); size_t sz = buf.sz; byte_t* ptr = buf.base; uint32_t msgid = m_NextTXMsgID++; diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index 2c9f62ea1..674686038 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -575,18 +575,10 @@ namespace llarp return; } } - if(m_LastRecvMessage && now > m_LastRecvMessage - && now - m_LastRecvMessage > PATH_ALIVE_TIMEOUT) + if(m_LastRecvMessage && now > m_LastRecvMessage) { - if(m_CheckForDead) - { - if(m_CheckForDead(this, dlt)) - { - r->routerProfiling().MarkPathFail(this); - EnterState(ePathTimeout, now); - } - } - else + auto dlt = now - m_LastRecvMessage; + if(m_CheckForDead && m_CheckForDead(this, dlt)) { r->routerProfiling().MarkPathFail(this); EnterState(ePathTimeout, now); diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index a6ff3c71a..09da10cd5 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -1057,8 +1057,11 @@ namespace llarp } bool - Endpoint::CheckPathIsDead(path::Path*, llarp_time_t) + Endpoint::CheckPathIsDead(path::Path*, llarp_time_t dlt) { + if(dlt <= 30000) + return false; + RouterLogic()->call_later( {100, this, [](void* u, uint64_t, uint64_t left) { if(left)