Skip to content

Commit

Permalink
net: Avoid calling getnameinfo when formatting IPv4 addresses in CNet…
Browse files Browse the repository at this point in the history
…Addr::ToStringIP
  • Loading branch information
practicalswift committed Apr 1, 2021
1 parent 5858057 commit 58580a8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/netaddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down

0 comments on commit 58580a8

Please sign in to comment.