Browse Source

don't connect to ipv6 address if not supported

pull/437/head
orignal 9 years ago
parent
commit
9bd97383bd
  1. 14
      Transports.cpp

14
Transports.cpp

@ -378,7 +378,9 @@ namespace transport @@ -378,7 +378,9 @@ namespace transport
{
auto address = (*it).endpoint ().address ();
LogPrint (eLogDebug, "Transports: ", (*it).host_name (), " has been resolved to ", address);
auto addr = peer.router->GetNTCPAddress ();
if (address.is_v4 () || context.SupportsV6 ())
{
auto addr = peer.router->GetNTCPAddress (); // TODO: take one we requested
if (addr)
{
auto s = std::make_shared<NTCPSession> (*m_NTCPServer, peer.router);
@ -386,6 +388,9 @@ namespace transport @@ -386,6 +388,9 @@ namespace transport
return;
}
}
else
LogPrint (eLogInfo, "Can't connect to NTCP ", address, " ipv6 is not supported");
}
LogPrint (eLogError, "Transports: Unable to resolve NTCP address: ", ecode.message ());
std::unique_lock<std::mutex> l(m_PeersMutex);
m_Peers.erase (it1);
@ -411,13 +416,18 @@ namespace transport @@ -411,13 +416,18 @@ namespace transport
{
auto address = (*it).endpoint ().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 ())
{
auto addr = peer.router->GetSSUAddress (); // TODO: take one we requested
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 ());
std::unique_lock<std::mutex> l(m_PeersMutex);
m_Peers.erase (it1);

Loading…
Cancel
Save