mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
add hooks for visiting netdb
This commit is contained in:
parent
28fdd992c9
commit
fec49e5609
4 changed files with 35 additions and 3 deletions
15
NetDb.cpp
15
NetDb.cpp
|
@ -329,6 +329,21 @@ namespace data
|
|||
for ( auto & entry : m_LeaseSets)
|
||||
v(entry.first, entry.second);
|
||||
}
|
||||
|
||||
void NetDb::VisitStoredRouterInfos(RouterInfoVisitor v)
|
||||
{
|
||||
m_Storage.Iterate([v] (const std::string & filename) {
|
||||
const i2p::data::RouterInfo ri(filename);
|
||||
v(ri);
|
||||
});
|
||||
}
|
||||
|
||||
void NetDb::VisitRouterInfos(RouterInfoVisitor v)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_RouterInfosMutex);
|
||||
for ( const auto & item : m_RouterInfos )
|
||||
v(*item.second);
|
||||
}
|
||||
|
||||
void NetDb::Load ()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue