mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-27 09:04:15 +00:00
don't connect to ipv6 address if not supported
This commit is contained in:
parent
522c7b2f9d
commit
9bd97383bd
@ -378,13 +378,18 @@ namespace transport
|
|||||||
{
|
{
|
||||||
auto address = (*it).endpoint ().address ();
|
auto address = (*it).endpoint ().address ();
|
||||||
LogPrint (eLogDebug, "Transports: ", (*it).host_name (), " has been resolved to ", address);
|
LogPrint (eLogDebug, "Transports: ", (*it).host_name (), " has been resolved to ", address);
|
||||||
auto addr = peer.router->GetNTCPAddress ();
|
if (address.is_v4 () || context.SupportsV6 ())
|
||||||
if (addr)
|
|
||||||
{
|
{
|
||||||
auto s = std::make_shared<NTCPSession> (*m_NTCPServer, peer.router);
|
auto addr = peer.router->GetNTCPAddress (); // TODO: take one we requested
|
||||||
m_NTCPServer->Connect (address, addr->port, s);
|
if (addr)
|
||||||
return;
|
{
|
||||||
|
auto s = std::make_shared<NTCPSession> (*m_NTCPServer, peer.router);
|
||||||
|
m_NTCPServer->Connect (address, addr->port, s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
LogPrint (eLogInfo, "Can't connect to NTCP ", address, " ipv6 is not supported");
|
||||||
}
|
}
|
||||||
LogPrint (eLogError, "Transports: Unable to resolve NTCP address: ", ecode.message ());
|
LogPrint (eLogError, "Transports: Unable to resolve NTCP address: ", ecode.message ());
|
||||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||||
@ -411,12 +416,17 @@ namespace transport
|
|||||||
{
|
{
|
||||||
auto address = (*it).endpoint ().address ();
|
auto address = (*it).endpoint ().address ();
|
||||||
LogPrint (eLogDebug, "Transports: ", (*it).host_name (), " has been resolved to ", address);
|
LogPrint (eLogDebug, "Transports: ", (*it).host_name (), " has been resolved to ", address);
|
||||||
auto addr = peer.router->GetSSUAddress (!context.SupportsV6 ());;
|
if (address.is_v4 () || context.SupportsV6 ())
|
||||||
if (addr)
|
|
||||||
{
|
{
|
||||||
m_SSUServer->CreateSession (peer.router, address, addr->port);
|
auto addr = peer.router->GetSSUAddress (); // TODO: take one we requested
|
||||||
return;
|
if (addr)
|
||||||
|
{
|
||||||
|
m_SSUServer->CreateSession (peer.router, address, addr->port);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
LogPrint (eLogInfo, "Can't connect to SSU ", address, " ipv6 is not supported");
|
||||||
}
|
}
|
||||||
LogPrint (eLogError, "Transports: Unable to resolve SSU address: ", ecode.message ());
|
LogPrint (eLogError, "Transports: Unable to resolve SSU address: ", ecode.message ());
|
||||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user