mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 02:44:15 +00:00
use shared pointers
This commit is contained in:
parent
970557660e
commit
ab763c38d9
@ -342,7 +342,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_RouterInfosMutex);
|
std::unique_lock<std::mutex> lock(m_RouterInfosMutex);
|
||||||
for ( const auto & item : m_RouterInfos )
|
for ( const auto & item : m_RouterInfos )
|
||||||
v(*item.second);
|
v(item.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t NetDb::VisitRandomRouterInfos(RouterInfoFilter filter, RouterInfoVisitor v, size_t n)
|
size_t NetDb::VisitRandomRouterInfos(RouterInfoFilter filter, RouterInfoVisitor v, size_t n)
|
||||||
@ -359,7 +359,7 @@ namespace data
|
|||||||
if(i >= idx) // are we at the random start point?
|
if(i >= idx) // are we at the random start point?
|
||||||
{
|
{
|
||||||
// yes, check if we want this one
|
// yes, check if we want this one
|
||||||
if(filter(*it.second))
|
if(filter(it.second))
|
||||||
{
|
{
|
||||||
// we have a match
|
// we have a match
|
||||||
--n;
|
--n;
|
||||||
@ -383,7 +383,7 @@ namespace data
|
|||||||
// visit the ones we found
|
// visit the ones we found
|
||||||
size_t visited = 0;
|
size_t visited = 0;
|
||||||
for(const auto & ri : found ) {
|
for(const auto & ri : found ) {
|
||||||
v(*ri);
|
v(ri);
|
||||||
++visited;
|
++visited;
|
||||||
}
|
}
|
||||||
return visited;
|
return visited;
|
||||||
|
4
NetDb.h
4
NetDb.h
@ -38,10 +38,10 @@ namespace data
|
|||||||
typedef std::function<void(const IdentHash, std::shared_ptr<LeaseSet>)> LeaseSetVisitor;
|
typedef std::function<void(const IdentHash, std::shared_ptr<LeaseSet>)> LeaseSetVisitor;
|
||||||
|
|
||||||
/** function for visiting a router info we have locally */
|
/** function for visiting a router info we have locally */
|
||||||
typedef std::function<void(const i2p::data::RouterInfo &)> RouterInfoVisitor;
|
typedef std::function<void(std::shared_ptr<const i2p::data::RouterInfo>)> RouterInfoVisitor;
|
||||||
|
|
||||||
/** function for visiting a router info and determining if we want to use it */
|
/** function for visiting a router info and determining if we want to use it */
|
||||||
typedef std::function<bool(const i2p::data::RouterInfo &)> RouterInfoFilter;
|
typedef std::function<bool(std::shared_ptr<const i2p::data::RouterInfo>)> RouterInfoFilter;
|
||||||
|
|
||||||
class NetDb
|
class NetDb
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user