From 5aa53eee43e484950f4a14a29feed131c595336f Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 2 Nov 2017 14:50:57 -0400 Subject: [PATCH] GetIdentity for RoutingDestination --- libi2pd/Identity.h | 4 +++- libi2pd/LeaseSet.h | 5 ++--- libi2pd/RouterInfo.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libi2pd/Identity.h b/libi2pd/Identity.h index 0258823b..ccd8ecee 100644 --- a/libi2pd/Identity.h +++ b/libi2pd/Identity.h @@ -186,9 +186,11 @@ namespace data RoutingDestination () {}; virtual ~RoutingDestination () {}; - virtual const IdentHash& GetIdentHash () const = 0; + virtual std::shared_ptr GetIdentity () const = 0; virtual const uint8_t * GetEncryptionPublicKey () const = 0; virtual bool IsDestination () const = 0; // for garlic + + const IdentHash& GetIdentHash () const { return GetIdentity ()->GetIdentHash (); }; }; class LocalDestination diff --git a/libi2pd/LeaseSet.h b/libi2pd/LeaseSet.h index 3499884a..68b993f3 100644 --- a/libi2pd/LeaseSet.h +++ b/libi2pd/LeaseSet.h @@ -59,8 +59,7 @@ namespace data ~LeaseSet () { delete[] m_Buffer; }; void Update (const uint8_t * buf, size_t len); bool IsNewer (const uint8_t * buf, size_t len) const; - void PopulateLeases (); // from buffer - std::shared_ptr GetIdentity () const { return m_Identity; }; + void PopulateLeases (); // from buffer const uint8_t * GetBuffer () const { return m_Buffer; }; size_t GetBufferLen () const { return m_BufferLen; }; @@ -76,7 +75,7 @@ namespace data { return m_BufferLen == other.m_BufferLen && !memcmp (m_Buffer, other.m_Buffer, m_BufferLen); }; // implements RoutingDestination - const IdentHash& GetIdentHash () const { return m_Identity->GetIdentHash (); }; + std::shared_ptr GetIdentity () const { return m_Identity; }; const uint8_t * GetEncryptionPublicKey () const { return m_EncryptionKey; }; bool IsDestination () const { return true; }; diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index f23fb152..544639f7 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -185,7 +185,7 @@ namespace data bool IsFamily(const std::string & fam) const; // implements RoutingDestination - const IdentHash& GetIdentHash () const { return m_RouterIdentity->GetIdentHash (); }; + std::shared_ptr GetIdentity () const { return m_RouterIdentity; }; const uint8_t * GetEncryptionPublicKey () const { return m_RouterIdentity->GetStandardIdentity ().publicKey; }; bool IsDestination () const { return false; };