Browse Source

use copy of excluded peers

pull/1941/merge
orignal 7 months ago
parent
commit
648a884a18
  1. 14
      libi2pd/NetDbRequests.cpp
  2. 4
      libi2pd/NetDbRequests.h

14
libi2pd/NetDbRequests.cpp

@ -67,6 +67,18 @@ namespace data
m_ExcludedPeers.clear (); m_ExcludedPeers.clear ();
} }
std::set<IdentHash> RequestedDestination::GetExcludedPeers () const
{
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
return m_ExcludedPeers;
}
size_t RequestedDestination::GetNumExcludedPeers () const
{
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
return m_ExcludedPeers.size ();
}
void RequestedDestination::Success (std::shared_ptr<RouterInfo> r) void RequestedDestination::Success (std::shared_ptr<RouterInfo> r)
{ {
m_IsActive = false; m_IsActive = false;
@ -188,7 +200,7 @@ namespace data
{ {
if (!dest) return false; if (!dest) return false;
bool ret = true; bool ret = true;
auto count = dest->GetExcludedPeers ().size (); auto count = dest->GetNumExcludedPeers ();
if (!dest->IsExploratory () && count < MAX_NUM_REQUEST_ATTEMPTS) if (!dest->IsExploratory () && count < MAX_NUM_REQUEST_ATTEMPTS)
{ {
auto nextFloodfill = netdb.GetClosestFloodfill (dest->GetDestination (), dest->GetExcludedPeers ()); auto nextFloodfill = netdb.GetClosestFloodfill (dest->GetDestination (), dest->GetExcludedPeers ());

4
libi2pd/NetDbRequests.h

@ -35,8 +35,8 @@ namespace data
~RequestedDestination (); ~RequestedDestination ();
const IdentHash& GetDestination () const { return m_Destination; }; const IdentHash& GetDestination () const { return m_Destination; };
int GetNumExcludedPeers () const { return m_ExcludedPeers.size (); }; size_t GetNumExcludedPeers () const;
const std::set<IdentHash>& GetExcludedPeers () const { return m_ExcludedPeers; }; std::set<IdentHash> GetExcludedPeers () const;
void ClearExcludedPeers (); void ClearExcludedPeers ();
bool IsExploratory () const { return m_IsExploratory; }; bool IsExploratory () const { return m_IsExploratory; };
bool IsDirect () const { return m_IsDirect; }; bool IsDirect () const { return m_IsDirect; };

Loading…
Cancel
Save