Skip to content

Commit 58580a8

Browse files
net: Avoid calling getnameinfo when formatting IPv4 addresses in CNetAddr::ToStringIP
1 parent 5858057 commit 58580a8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/netaddress.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ std::string CNetAddr::ToStringIP() const
576576
{
577577
switch (m_net) {
578578
case NET_IPV4:
579+
return IPv4ToString(m_addr);
579580
case NET_IPV6: {
580581
CService serv(*this, 0);
581582
struct sockaddr_storage sockaddr;
@@ -586,9 +587,6 @@ std::string CNetAddr::ToStringIP() const
586587
sizeof(name), nullptr, 0, NI_NUMERICHOST))
587588
return std::string(name);
588589
}
589-
if (m_net == NET_IPV4) {
590-
return IPv4ToString(m_addr);
591-
}
592590
return IPv6ToString(m_addr);
593591
}
594592
case NET_ONION:

0 commit comments

Comments
 (0)