mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
net: Avoid calling getnameinfo when formatting IPv4 addresses in CNetAddr::ToStringIP
This commit is contained in:
parent
5858057384
commit
58580a827d
1 changed files with 1 additions and 3 deletions
|
@ -576,6 +576,7 @@ std::string CNetAddr::ToStringIP() const
|
||||||
{
|
{
|
||||||
switch (m_net) {
|
switch (m_net) {
|
||||||
case NET_IPV4:
|
case NET_IPV4:
|
||||||
|
return IPv4ToString(m_addr);
|
||||||
case NET_IPV6: {
|
case NET_IPV6: {
|
||||||
CService serv(*this, 0);
|
CService serv(*this, 0);
|
||||||
struct sockaddr_storage sockaddr;
|
struct sockaddr_storage sockaddr;
|
||||||
|
@ -586,9 +587,6 @@ std::string CNetAddr::ToStringIP() const
|
||||||
sizeof(name), nullptr, 0, NI_NUMERICHOST))
|
sizeof(name), nullptr, 0, NI_NUMERICHOST))
|
||||||
return std::string(name);
|
return std::string(name);
|
||||||
}
|
}
|
||||||
if (m_net == NET_IPV4) {
|
|
||||||
return IPv4ToString(m_addr);
|
|
||||||
}
|
|
||||||
return IPv6ToString(m_addr);
|
return IPv6ToString(m_addr);
|
||||||
}
|
}
|
||||||
case NET_ONION:
|
case NET_ONION:
|
||||||
|
|
Loading…
Add table
Reference in a new issue