Skip to content

Commit 9d38421

Browse files
Updated SubscriberConnection to use common ResolveDNSName function
1 parent 0838d8e commit 9d38421

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

src/lib/transport/SubscriberConnection.cpp

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -453,38 +453,7 @@ void SubscriberConnection::StartConnection(const bool connectionAccepted)
453453
// Attempt to lookup remote connection identification for logging purposes
454454
const auto remoteEndPoint = m_commandChannelSocket.remote_endpoint();
455455
m_ipAddress = remoteEndPoint.address();
456-
457-
if (remoteEndPoint.protocol() == tcp::v6())
458-
m_connectionID = "[" + m_ipAddress.to_string() + "]:" + ToString(remoteEndPoint.port());
459-
else
460-
m_connectionID = m_ipAddress.to_string() + ":" + ToString(remoteEndPoint.port());
461-
462-
try
463-
{
464-
DnsResolver resolver(m_commandChannelService);
465-
const DnsResolver::query dnsQuery(m_ipAddress.to_string(), ToString(remoteEndPoint.port()));
466-
DnsResolver::iterator iterator = resolver.resolve(dnsQuery);
467-
const DnsResolver::iterator end;
468-
469-
while (iterator != end)
470-
{
471-
const auto& endPoint = *iterator++;
472-
473-
if (!endPoint.host_name().empty())
474-
{
475-
m_hostName = endPoint.host_name();
476-
m_connectionID = m_hostName + " (" + m_connectionID + ")";
477-
break;
478-
}
479-
}
480-
}
481-
catch (...)
482-
{ //-V565
483-
// DNS lookup failure is not catastrophic
484-
}
485-
486-
if (m_hostName.empty())
487-
m_hostName = m_ipAddress.to_string();
456+
m_connectionID = ResolveDNSName(m_commandChannelService, remoteEndPoint, m_hostName);
488457

489458
m_stopped = false;
490459

0 commit comments

Comments
 (0)