From 309a899c9f7d64b20431ef61ac7b3b90c8a373ef Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Wed, 31 Mar 2021 13:09:34 -0400 Subject: [PATCH] mark loopback convotags as forever make null handler mark discard data as activity for convotag --- llarp/handlers/null.hpp | 4 +++- llarp/service/endpoint.cpp | 2 +- llarp/service/session.cpp | 2 ++ llarp/service/session.hpp | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/llarp/handlers/null.hpp b/llarp/handlers/null.hpp index 9ce9f63d5..fde860543 100644 --- a/llarp/handlers/null.hpp +++ b/llarp/handlers/null.hpp @@ -48,8 +48,10 @@ namespace llarp uint64_t seqno) override { if (t == service::ProtocolType::Control) + { + MarkConvoTagActive(tag); return true; - + } if (t != service::ProtocolType::QUIC) return false; diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index deac1671f..7a6485f8f 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -1536,9 +1536,9 @@ namespace llarp tag = *maybe; else tag.Randomize(); - PutSenderFor(tag, m_Identity.pub, true); MarkConvoTagActive(tag); + Sessions()[tag].forever = true; Loop()->call_soon([tag, hook]() { hook(tag); }); return true; } diff --git a/llarp/service/session.cpp b/llarp/service/session.cpp index 1163a86c0..2fd3dbfdf 100644 --- a/llarp/service/session.cpp +++ b/llarp/service/session.cpp @@ -19,6 +19,8 @@ namespace llarp bool Session::IsExpired(llarp_time_t now, llarp_time_t lifetime) const { + if (forever) + return false; return now > lastUsed && (now - lastUsed > lifetime || intro.IsExpired(now)); } diff --git a/llarp/service/session.hpp b/llarp/service/session.hpp index 3369e0482..035d922f4 100644 --- a/llarp/service/session.hpp +++ b/llarp/service/session.hpp @@ -26,6 +26,7 @@ namespace llarp llarp_time_t lastUsed = 0s; uint64_t seqno = 0; bool inbound = false; + bool forever = false; util::StatusObject ExtractStatus() const;