Browse Source

select appropritae address

pull/437/head
orignal 9 years ago
parent
commit
5befe1f019
  1. 12
      Transports.cpp

12
Transports.cpp

@ -375,6 +375,8 @@ namespace transport
{ {
auto& peer = it1->second; auto& peer = it1->second;
if (!ecode && peer.router) if (!ecode && peer.router)
{
while (it != boost::asio::ip::tcp::resolver::iterator())
{ {
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);
@ -387,9 +389,11 @@ namespace transport
m_NTCPServer->Connect (address, addr->port, s); m_NTCPServer->Connect (address, addr->port, s);
return; return;
} }
break;
} }
else else
LogPrint (eLogInfo, "Can't connect to NTCP ", address, " ipv6 is not supported"); LogPrint (eLogInfo, "Transports: NTCP ", address, " 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);
@ -413,6 +417,8 @@ namespace transport
{ {
auto& peer = it1->second; auto& peer = it1->second;
if (!ecode && peer.router) if (!ecode && peer.router)
{
while (it != boost::asio::ip::tcp::resolver::iterator())
{ {
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);
@ -424,9 +430,11 @@ namespace transport
m_SSUServer->CreateSession (peer.router, address, addr->port); m_SSUServer->CreateSession (peer.router, address, addr->port);
return; return;
} }
break;
} }
else else
LogPrint (eLogInfo, "Can't connect to SSU ", address, " ipv6 is not supported"); LogPrint (eLogInfo, "Transports: SSU ", address, " 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…
Cancel
Save