From 58cf26c3049cee5f45b76361fadb65d74d32b240 Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 15 Jan 2022 19:26:11 -0500 Subject: [PATCH] cleanup properties before update --- libi2pd/RouterInfo.cpp | 1 + libi2pd/RouterInfo.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index 766f07b4..ed6439df 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -97,6 +97,7 @@ namespace data m_ReachableTransports = 0; m_Caps = 0; // don't clean up m_Addresses, it will be replaced in ReadFromStream + ClearProperties (); // copy buffer UpdateBuffer (buf, len); // skip identity diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index f2f91395..ff682495 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -182,6 +182,7 @@ namespace data uint64_t GetTimestamp () const { return m_Timestamp; }; int GetVersion () const { return m_Version; }; virtual void SetProperty (const std::string& key, const std::string& value) {}; + virtual void ClearProperties () {}; Addresses& GetAddresses () { return *m_Addresses; }; // should be called for local RI only, otherwise must return shared_ptr std::shared_ptr GetNTCP2AddressWithStaticKey (const uint8_t * key) const; std::shared_ptr GetPublishedNTCP2V4Address () const; @@ -302,7 +303,7 @@ namespace data void SetProperty (const std::string& key, const std::string& value) override; void DeleteProperty (const std::string& key); std::string GetProperty (const std::string& key) const; - void ClearProperties () { m_Properties.clear (); }; + void ClearProperties () override { m_Properties.clear (); }; private: