diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2021-04-01 08:01:33 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2021-04-01 08:06:01 +0000 |
commit | 58580a827d10c0675c3483e2aeca1d3ab8050ae0 (patch) | |
tree | 2090ab901a3c82765a77bf5c66de104172daffcc | |
parent | 58580573843858068db69a378b6e9363889b1f6d (diff) | |
download | bitcoin-58580a827d10c0675c3483e2aeca1d3ab8050ae0.tar.xz |
net: Avoid calling getnameinfo when formatting IPv4 addresses in CNetAddr::ToStringIP
-rw-r--r-- | src/netaddress.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/netaddress.cpp b/src/netaddress.cpp index b2a7a29d06..d56ae78e92 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -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: |