mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
add lease set page in http server
This commit is contained in:
parent
4fdd9feddc
commit
71cc4b5bf2
4 changed files with 76 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue