Skip to content

Commit

Permalink
iterator through resolver's results
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Nov 26, 2024
1 parent ffd18ba commit cc768de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions libi2pd/Reseed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,9 @@ namespace data
if (!ecode)
{
bool connected = false;
for (auto it = endpoints.begin (); it != endpoints.end ();)
for (const auto& it: endpoints)
{
boost::asio::ip::tcp::endpoint ep = *it;
boost::asio::ip::tcp::endpoint ep = it;
bool supported = false;
if (!ep.address ().is_unspecified ())
{
Expand All @@ -663,7 +663,6 @@ namespace data
break;
}
}
it++;
}
if (!connected)
{
Expand Down Expand Up @@ -750,9 +749,9 @@ namespace data
if (!ecode)
{
bool connected = false;
for (auto it = endpoints.begin (); it != endpoints.end ();)
for (const auto& it: endpoints)
{
boost::asio::ip::tcp::endpoint ep = *it;
boost::asio::ip::tcp::endpoint ep = it;
if (
i2p::util::net::IsYggdrasilAddress (ep.address ()) &&
i2p::context.SupportsMesh ()
Expand All @@ -766,7 +765,6 @@ namespace data
break;
}
}
it++;
}
if (!connected)
{
Expand Down
5 changes: 2 additions & 3 deletions libi2pd/Timestamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ namespace util
{
bool found = false;
boost::asio::ip::udp::endpoint ep;
for (auto it = endpoints.begin (); it != endpoints.end ();)
for (const auto& it: endpoints)
{
ep = *it;
ep = it;
if (!ep.address ().is_unspecified ())
{
if (ep.address ().is_v4 ())
Expand All @@ -86,7 +86,6 @@ namespace util
}
}
if (found) break;
it++;
}
if (!found)
{
Expand Down
5 changes: 2 additions & 3 deletions libi2pd_client/I2PTunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,9 +752,9 @@ namespace client
boost::asio::ip::tcp::endpoint ep;
if (m_LocalAddress)
{
for (auto it = endpoints.begin (); it != endpoints.end ();)
for (const auto& it: endpoints)
{
ep = *it;
ep = it;
if (!ep.address ().is_unspecified ())
{
if (ep.address ().is_v4 ())
Expand All @@ -773,7 +773,6 @@ namespace client
}
}
if (found) break;
it++;
}
}
else
Expand Down

0 comments on commit cc768de

Please sign in to comment.