From a94c100e7bf4707df2ac463207ddddbfae9e52c5 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Thu, 3 Jun 2021 08:21:15 -0400 Subject: [PATCH] improve log messages about expiring convotags --- llarp/service/endpoint_util.cpp | 8 ++++++-- llarp/service/outbound_context.cpp | 6 ++++++ llarp/service/outbound_context.hpp | 3 +++ llarp/service/session.cpp | 8 +++++++- llarp/service/session.hpp | 3 +++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/llarp/service/endpoint_util.cpp b/llarp/service/endpoint_util.cpp index 782e2968e..f4400cda7 100644 --- a/llarp/service/endpoint_util.cpp +++ b/llarp/service/endpoint_util.cpp @@ -95,7 +95,11 @@ namespace llarp itr->second->Tick(now); if (itr->second->Pump(now)) { - LogInfo("marking session as dead T=", itr->second->currentConvoTag); + LogInfo( + "marking session as dead T=", + itr->second->currentConvoTag, + " to ", + itr->second->Addr()); itr->second->Stop(); sessions.erase(itr->second->currentConvoTag); deadSessions.emplace(std::move(*itr)); @@ -120,7 +124,7 @@ namespace llarp { if (itr->second.IsExpired(now)) { - LogInfo("Expire session T=", itr->first); + LogInfo("Expire session T=", itr->first, " to ", itr->second.Addr()); itr = sessions.erase(itr); } else diff --git a/llarp/service/outbound_context.cpp b/llarp/service/outbound_context.cpp index 9837248a1..ff17b9f64 100644 --- a/llarp/service/outbound_context.cpp +++ b/llarp/service/outbound_context.cpp @@ -88,6 +88,12 @@ namespace llarp } } + Address + OutboundContext::Addr() const + { + return addr; + } + bool OutboundContext::OnIntroSetUpdate( const Address&, diff --git a/llarp/service/outbound_context.hpp b/llarp/service/outbound_context.hpp index 6b5d00b84..e18bb6430 100644 --- a/llarp/service/outbound_context.hpp +++ b/llarp/service/outbound_context.hpp @@ -38,6 +38,9 @@ namespace llarp return shared_from_this(); } + Address + Addr() const; + bool Stop() override; diff --git a/llarp/service/session.cpp b/llarp/service/session.cpp index 6238a2166..e54f722ca 100644 --- a/llarp/service/session.cpp +++ b/llarp/service/session.cpp @@ -11,7 +11,7 @@ namespace llarp {"lastSend", to_json(lastSend)}, {"lastRecv", to_json(lastRecv)}, {"replyIntro", replyIntro.ExtractStatus()}, - {"remote", remote.Addr().ToString()}, + {"remote", Addr().ToString()}, {"seqno", seqno}, {"tx", messagesSend}, {"rx", messagesRecv}, @@ -19,6 +19,12 @@ namespace llarp return obj; } + Address + Session::Addr() const + { + return remote.Addr(); + } + bool Session::IsExpired(llarp_time_t now, llarp_time_t lifetime) const { diff --git a/llarp/service/session.hpp b/llarp/service/session.hpp index 414cbea91..feb3aee4f 100644 --- a/llarp/service/session.hpp +++ b/llarp/service/session.hpp @@ -49,6 +49,9 @@ namespace llarp bool IsExpired(llarp_time_t now, llarp_time_t lifetime = SessionLifetime) const; + + Address + Addr() const; }; } // namespace service