Browse Source

reseed from compatible address

pull/1656/head
orignal 4 years ago
parent
commit
ca77ca6ef0
  1. 25
      libi2pd/Reseed.cpp

25
libi2pd/Reseed.cpp

@ -679,7 +679,30 @@ namespace data @@ -679,7 +679,30 @@ namespace data
auto it = boost::asio::ip::tcp::resolver(service).resolve (
boost::asio::ip::tcp::resolver::query (url.host, std::to_string(url.port)), ecode);
if (!ecode)
s.lowest_layer().connect (*it, ecode);
{
bool connected = false;
boost::asio::ip::tcp::resolver::iterator end;
while (it != end)
{
boost::asio::ip::tcp::endpoint ep = *it;
if ((ep.address ().is_v4 () && i2p::context.SupportsV4 ()) ||
(ep.address ().is_v6 () && i2p::context.SupportsV6 ()))
{
s.lowest_layer().connect (ep, ecode);
if (!ecode)
{
connected = true;
break;
}
}
it++;
}
if (!connected)
{
LogPrint(eLogError, "Reseed: Failed to connect to ", url.host);
return "";
}
}
}
if (!ecode)
{

Loading…
Cancel
Save