From f4ea6138e8d709cffceb4ac26ea312a4b43ce149 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 23 May 2024 13:36:29 -0400 Subject: [PATCH] removed non longer used mutex --- libi2pd/NetDbRequests.cpp | 10 ---------- libi2pd/NetDbRequests.h | 9 ++++----- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/libi2pd/NetDbRequests.cpp b/libi2pd/NetDbRequests.cpp index 9ab2411e..2ea1be50 100644 --- a/libi2pd/NetDbRequests.cpp +++ b/libi2pd/NetDbRequests.cpp @@ -35,7 +35,6 @@ namespace data std::shared_ptr RequestedDestination::CreateRequestMessage (std::shared_ptr router, std::shared_ptr replyTunnel) { - std::lock_guard l (m_ExcludedPeersMutex); std::shared_ptr msg; if(replyTunnel) msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination, @@ -52,7 +51,6 @@ namespace data std::shared_ptr RequestedDestination::CreateRequestMessage (const IdentHash& floodfill) { - std::lock_guard l (m_ExcludedPeersMutex); auto msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination, i2p::context.GetRouterInfo ().GetIdentHash () , 0, false, &m_ExcludedPeers); m_ExcludedPeers.insert (floodfill); @@ -63,21 +61,13 @@ namespace data bool RequestedDestination::IsExcluded (const IdentHash& ident) const { - std::lock_guard l (m_ExcludedPeersMutex); return m_ExcludedPeers.count (ident); } void RequestedDestination::ClearExcludedPeers () { - std::lock_guard l (m_ExcludedPeersMutex); m_ExcludedPeers.clear (); } - - std::unordered_set RequestedDestination::GetExcludedPeers () const - { - std::lock_guard l (m_ExcludedPeersMutex); - return m_ExcludedPeers; - } void RequestedDestination::Success (std::shared_ptr r) { diff --git a/libi2pd/NetDbRequests.h b/libi2pd/NetDbRequests.h index 9901c9c7..5ceb7b4c 100644 --- a/libi2pd/NetDbRequests.h +++ b/libi2pd/NetDbRequests.h @@ -41,7 +41,7 @@ namespace data ~RequestedDestination (); const IdentHash& GetDestination () const { return m_Destination; }; - std::unordered_set GetExcludedPeers () const; + const std::unordered_set& GetExcludedPeers () const { return m_ExcludedPeers; }; int GetNumAttempts () const { return m_NumAttempts; }; void ClearExcludedPeers (); bool IsExploratory () const { return m_IsExploratory; }; @@ -63,7 +63,6 @@ namespace data IdentHash m_Destination; bool m_IsExploratory, m_IsDirect, m_IsActive; - mutable std::mutex m_ExcludedPeersMutex; std::unordered_set m_ExcludedPeers; uint64_t m_CreationTime, m_LastRequestTime; // in seconds RequestComplete m_RequestComplete; @@ -84,14 +83,14 @@ namespace data std::shared_ptr CreateRequest (const IdentHash& destination, bool isExploratory, bool direct = false, RequestedDestination::RequestComplete requestComplete = nullptr); void RequestComplete (const IdentHash& ident, std::shared_ptr r); - std::shared_ptr FindRequest (const IdentHash& ident) const; - bool SendNextRequest (std::shared_ptr dest); - void PostDatabaseSearchReplyMsg (std::shared_ptr msg); void PostRequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct); private: + std::shared_ptr FindRequest (const IdentHash& ident) const; + bool SendNextRequest (std::shared_ptr dest); + void HandleDatabaseSearchReplyMsg (std::shared_ptr msg); void RequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct); void Explore (int numDestinations);