net: Avoid calling getnameinfo when formatting IPv4 addresses in CNetAddr::ToStringIP

pull/826/head
practicalswift 4 years ago
parent 5858057384
commit 58580a827d

@ -576,6 +576,7 @@ std::string CNetAddr::ToStringIP() const
{
switch (m_net) {
case NET_IPV4:
return IPv4ToString(m_addr);
case NET_IPV6: {
CService serv(*this, 0);
struct sockaddr_storage sockaddr;
@ -586,9 +587,6 @@ std::string CNetAddr::ToStringIP() const
sizeof(name), nullptr, 0, NI_NUMERICHOST))
return std::string(name);
}
if (m_net == NET_IPV4) {
return IPv4ToString(m_addr);
}
return IPv6ToString(m_addr);
}
case NET_ONION:

Loading…
Cancel
Save