add lease set page in http server

This commit is contained in:
Jeff Becker 2016-07-15 09:38:21 -04:00
parent 4fdd9feddc
commit 71cc4b5bf2
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
4 changed files with 76 additions and 3 deletions

View file

@ -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