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

prevent bad side effects, dont use iterator after use and use operator[]

This commit is contained in:
Jeff Becker 2021-02-18 18:51:43 -05:00
parent b2b68c413c
commit dc68ff6de9
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05

View file

@ -9,7 +9,7 @@ namespace llarp
void
RoutePoker::AddRoute(huint32_t ip)
{
m_PokedRoutes.emplace(ip, m_CurrentGateway);
m_PokedRoutes[ip] = m_CurrentGateway;
if (m_CurrentGateway.h == 0)
{
llarp::LogDebug("RoutePoker::AddRoute no current gateway, cannot enable route.");
@ -44,10 +44,10 @@ namespace llarp
const auto itr = m_PokedRoutes.find(ip);
if (itr == m_PokedRoutes.end())
return;
m_PokedRoutes.erase(itr);
if (m_Enabled)
DisableRoute(itr->first, itr->second);
m_PokedRoutes.erase(itr);
}
void