mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
add lease set page in http server
This commit is contained in:
@@ -213,6 +213,7 @@ namespace data
|
||||
bool NetDb::AddLeaseSet (const IdentHash& ident, const uint8_t * buf, int len,
|
||||
std::shared_ptr<i2p::tunnel::InboundTunnel> from)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_LeaseSetsMutex);
|
||||
bool updated = false;
|
||||
if (!from) // unsolicited LS must be received directly
|
||||
{
|
||||
@@ -264,6 +265,7 @@ namespace data
|
||||
|
||||
std::shared_ptr<LeaseSet> NetDb::FindLeaseSet (const IdentHash& destination) const
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_LeaseSetsMutex);
|
||||
auto it = m_LeaseSets.find (destination);
|
||||
if (it != m_LeaseSets.end ())
|
||||
return it->second;
|
||||
@@ -318,6 +320,13 @@ namespace data
|
||||
return true;
|
||||
}
|
||||
|
||||
void NetDb::VisitLeaseSets(LeaseSetVisitor v)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_LeaseSetsMutex);
|
||||
for ( auto & entry : m_LeaseSets)
|
||||
v(entry.first, entry.second);
|
||||
}
|
||||
|
||||
void NetDb::Load ()
|
||||
{
|
||||
// make sure we cleanup netDb from previous attempts
|
||||
|
||||
Reference in New Issue
Block a user