1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

friendship with std::unordered_map is now over, std::map is my new best friend

This commit is contained in:
Jeff Becker 2018-11-15 11:12:05 -05:00
parent c7c6905e1e
commit 723351eb4e
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -104,11 +104,7 @@ namespace llarp
{
huint32_t found = {0};
KeyMap_t::iterator itr = m_KeyToIP.find(pk);
if(itr != m_KeyToIP.end())
{
found.h = itr->second.h;
}
else
if(itr == m_KeyToIP.end())
{
// allocate and map
found = AllocateNewAddress();
@ -122,11 +118,13 @@ namespace llarp
llarp::LogError(Name(), "failed to map ", found, " to ", pk);
return found;
}
if(m_KeyToIP.find(pk) != m_KeyToIP.end())
if(m_KeyToIP.count(pk))
llarp::LogInfo(Name(), " mapping ", pk, " to ", found);
else
llarp::LogError(Name(), "failed to map ", pk, " to ", found);
}
else
found.h = itr->second.h;
MarkIPActive(found);