From 6f7ab49346897e259d792a0b94d5b55a24c96c69 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 19 Jul 2022 17:02:37 -0400 Subject: [PATCH] moved creation time to TransportSession --- libi2pd/SSUSession.cpp | 1 - libi2pd/SSUSession.h | 3 --- libi2pd/TransportSession.h | 5 +++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libi2pd/SSUSession.cpp b/libi2pd/SSUSession.cpp index 817133e8..76b6486b 100644 --- a/libi2pd/SSUSession.cpp +++ b/libi2pd/SSUSession.cpp @@ -41,7 +41,6 @@ namespace transport i2p::context.GetRouterInfo ().GetSSUAddress (true); if (address) m_IntroKey = address->i; } - m_CreationTime = i2p::util::GetSecondsSinceEpoch (); } SSUSession::~SSUSession () diff --git a/libi2pd/SSUSession.h b/libi2pd/SSUSession.h index 535de328..e28b4991 100644 --- a/libi2pd/SSUSession.h +++ b/libi2pd/SSUSession.h @@ -103,8 +103,6 @@ namespace transport void SendKeepAlive (); uint32_t GetRelayTag () const { return m_RelayTag; }; const i2p::data::RouterInfo::IntroKey& GetIntroKey () const { return m_IntroKey; }; - uint32_t GetCreationTime () const { return m_CreationTime; }; - void SetCreationTime (uint32_t ts) { m_CreationTime = ts; }; // for introducers void FlushData (); void CleanUp (uint64_t ts); @@ -167,7 +165,6 @@ namespace transport i2p::crypto::AESKey m_SessionKey; i2p::crypto::MACKey m_MacKey; i2p::data::RouterInfo::IntroKey m_IntroKey; - uint32_t m_CreationTime; // seconds since epoch SSUData m_Data; bool m_IsDataReceived; std::unique_ptr m_SignedData; // we need it for SessionConfirmed only diff --git a/libi2pd/TransportSession.h b/libi2pd/TransportSession.h index c05b46ac..53192816 100644 --- a/libi2pd/TransportSession.h +++ b/libi2pd/TransportSession.h @@ -79,6 +79,7 @@ namespace transport { if (router) m_RemoteIdentity = router->GetRouterIdentity (); + m_CreationTime = m_LastActivityTimestamp; } virtual ~TransportSession () {}; @@ -106,6 +107,9 @@ namespace transport bool IsTerminationTimeoutExpired (uint64_t ts) const { return ts >= m_LastActivityTimestamp + GetTerminationTimeout (); }; + uint32_t GetCreationTime () const { return m_CreationTime; }; + void SetCreationTime (uint32_t ts) { m_CreationTime = ts; }; // for introducers + virtual uint32_t GetRelayTag () const { return 0; }; virtual void SendLocalRouterInfo (bool update = false) { SendI2NPMessages ({ CreateDatabaseStoreMsg () }); }; virtual void SendI2NPMessages (const std::vector >& msgs) = 0; @@ -118,6 +122,7 @@ namespace transport bool m_IsOutgoing; int m_TerminationTimeout; uint64_t m_LastActivityTimestamp; + uint32_t m_CreationTime; // seconds since epoch }; } }