mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-24 22:44:15 +00:00
take first avalable resolved address if local address is not specified
This commit is contained in:
parent
797f5eb714
commit
b0874410f1
@ -606,35 +606,42 @@ namespace client
|
|||||||
if (!ecode)
|
if (!ecode)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
boost::asio::ip::tcp::resolver::iterator end;
|
|
||||||
boost::asio::ip::tcp::endpoint ep;
|
boost::asio::ip::tcp::endpoint ep;
|
||||||
while (it != end)
|
if (m_LocalAddress)
|
||||||
{
|
{
|
||||||
ep = *it;
|
boost::asio::ip::tcp::resolver::iterator end;
|
||||||
if (!ep.address ().is_unspecified ())
|
while (it != end)
|
||||||
{
|
{
|
||||||
if (ep.address ().is_v4 ())
|
ep = *it;
|
||||||
{
|
if (!ep.address ().is_unspecified ())
|
||||||
if (!m_LocalAddress || m_LocalAddress->is_v4 ()) // look for ipv4 if not specified
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else if (ep.address ().is_v6 ())
|
|
||||||
{
|
{
|
||||||
if (i2p::util::net::IsYggdrasilAddress (ep.address ()))
|
if (ep.address ().is_v4 ())
|
||||||
|
{
|
||||||
|
if (m_LocalAddress->is_v4 ()) found = true;
|
||||||
|
}
|
||||||
|
else if (ep.address ().is_v6 ())
|
||||||
{
|
{
|
||||||
if (m_LocalAddress && i2p::util::net::IsYggdrasilAddress (*m_LocalAddress))
|
if (i2p::util::net::IsYggdrasilAddress (ep.address ()))
|
||||||
|
{
|
||||||
|
if (i2p::util::net::IsYggdrasilAddress (*m_LocalAddress))
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else if (m_LocalAddress->is_v6 ())
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else if (m_LocalAddress && m_LocalAddress->is_v6 ())
|
}
|
||||||
found = true;
|
if (found) break;
|
||||||
}
|
it++;
|
||||||
}
|
}
|
||||||
if (found) break;
|
}
|
||||||
it++;
|
else
|
||||||
}
|
{
|
||||||
|
found = true;
|
||||||
|
ep = *it; // first available
|
||||||
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "I2PTunnel: Unable to reslove to compatible address");
|
LogPrint (eLogError, "I2PTunnel: Unable to resolve to compatible address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user