diff --git a/llarp/link/utp.cpp b/llarp/link/utp.cpp index 60f4bf8af..dbbea5eeb 100644 --- a/llarp/link/utp.cpp +++ b/llarp/link/utp.cpp @@ -87,6 +87,9 @@ namespace llarp ssize_t s = utp_writev(sock, vecs.data(), vecs.size()); if(s < 0) return; + if(s > 0) + lastSend = parent->Now(); + METRICS_DYNAMIC_INT_UPDATE( "utp.session.tx", RouterID(remoteRC.pubkey).ToString().c_str(), s); m_TXRate += s; @@ -241,7 +244,7 @@ namespace llarp return false; if(sendq.size() >= MaxSendQueueSize) { - return now - lastActive > 5000; + return now - lastSend > 5000; } // let utp manage this return state == eClose; diff --git a/llarp/link/utp_internal.hpp b/llarp/link/utp_internal.hpp index 8671dac59..2461b2f5f 100644 --- a/llarp/link/utp_internal.hpp +++ b/llarp/link/utp_internal.hpp @@ -109,6 +109,8 @@ namespace llarp SharedSecret txKey; /// timestamp last active llarp_time_t lastActive; + /// timestamp last send success + llarp_time_t lastSend; /// session timeout (60s) const static llarp_time_t sessionTimeout = DefaultLinkSessionLifetime;