Browse Source

use unordered_map for LeaseSets

pull/1919/head
orignal 1 year ago
parent
commit
5769a41208
  1. 11
      libi2pd/Destination.cpp
  2. 5
      libi2pd/Destination.h

11
libi2pd/Destination.cpp

@ -262,17 +262,6 @@ namespace client @@ -262,17 +262,6 @@ namespace client
return nullptr;
}
}
else
{
auto ls = i2p::data::netdb.FindLeaseSet (ident);
if (ls && !ls->IsExpired ())
{
ls->PopulateLeases (); // since we don't store them in netdb
std::lock_guard<std::mutex> _lock(m_RemoteLeaseSetsMutex);
m_RemoteLeaseSets[ident] = ls;
return ls;
}
}
return nullptr;
}

5
libi2pd/Destination.h

@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
#include <mutex>
#include <memory>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <functional>
@ -184,8 +185,8 @@ namespace client @@ -184,8 +185,8 @@ namespace client
boost::asio::io_service& m_Service;
mutable std::mutex m_RemoteLeaseSetsMutex;
std::map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
std::map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
std::shared_ptr<i2p::tunnel::TunnelPool> m_Pool;
std::mutex m_LeaseSetMutex;

Loading…
Cancel
Save