try fixing crash

This commit is contained in:
Jeff Becker 2018-12-18 13:36:19 -05:00
parent 8ee36d71ff
commit 3115636024
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
3 changed files with 11 additions and 13 deletions

View File

@ -659,9 +659,9 @@ namespace llarp
std::vector< RouterID > closer;
Key_t t(target.data());
std::set< Key_t > found;
// TODO: also load from nodedb
if(!nodes)
return false;
size_t nodeCount = nodes->Size();
if(nodeCount == 0)
{

View File

@ -86,8 +86,7 @@ namespace llarp
}
Path*
PathSet::GetEstablishedPathClosestTo(const RouterID& id,
PathRole roles) const
PathSet::GetEstablishedPathClosestTo(RouterID id, PathRole roles) const
{
Lock_t l(m_PathsMutex);
Path* path = nullptr;
@ -111,7 +110,7 @@ namespace llarp
}
Path*
PathSet::GetNewestPathByRouter(const RouterID& id, PathRole roles) const
PathSet::GetNewestPathByRouter(RouterID id, PathRole roles) const
{
Lock_t l(m_PathsMutex);
Path* chosen = nullptr;
@ -134,7 +133,7 @@ namespace llarp
}
Path*
PathSet::GetPathByRouter(const RouterID& id, PathRole roles) const
PathSet::GetPathByRouter(RouterID id, PathRole roles) const
{
Lock_t l(m_PathsMutex);
Path* chosen = nullptr;
@ -157,7 +156,7 @@ namespace llarp
}
Path*
PathSet::GetPathByID(const PathID_t& id) const
PathSet::GetPathByID(PathID_t id) const
{
Lock_t l(m_PathsMutex);
auto itr = m_Paths.begin();
@ -218,7 +217,7 @@ namespace llarp
}
Path*
PathSet::GetByUpstream(const RouterID& remote, const PathID_t& rxid) const
PathSet::GetByUpstream(RouterID remote, PathID_t rxid) const
{
Lock_t l(m_PathsMutex);
auto itr = m_Paths.find({remote, rxid});

View File

@ -84,7 +84,7 @@ namespace llarp
AddPath(Path* path);
Path*
GetByUpstream(const RouterID& remote, const PathID_t& rxid) const;
GetByUpstream(RouterID remote, PathID_t rxid) const;
void
ExpirePaths(llarp_time_t now);
@ -143,22 +143,21 @@ namespace llarp
}
Path*
GetEstablishedPathClosestTo(const RouterID& router,
GetEstablishedPathClosestTo(RouterID router,
PathRole roles = ePathRoleAny) const;
Path*
PickRandomEstablishedPath(PathRole roles = ePathRoleAny) const;
Path*
GetPathByRouter(const RouterID& router,
PathRole roles = ePathRoleAny) const;
GetPathByRouter(RouterID router, PathRole roles = ePathRoleAny) const;
Path*
GetNewestPathByRouter(const RouterID& router,
GetNewestPathByRouter(RouterID router,
PathRole roles = ePathRoleAny) const;
Path*
GetPathByID(const PathID_t& id) const;
GetPathByID(PathID_t id) const;
bool
GetCurrentIntroductionsWithFilter(