diff options
author | brunoerg <brunoely.gc@gmail.com> | 2022-10-11 13:37:45 -0300 |
---|---|---|
committer | brunoerg <brunoely.gc@gmail.com> | 2023-05-26 13:41:07 -0300 |
commit | 5c832c3820253affc65c0ed490e26e5b0a4d5c9b (patch) | |
tree | 3b57a22231de464f33b256cf21c9c300482ca499 /src/zmq | |
parent | 34bcdfc6a65de906c65edccdd96fe15219081cd2 (diff) |
p2p, refactor: return `std::optional<CNetAddr>` in `LookupHost`
Diffstat (limited to 'src/zmq')
-rw-r--r-- | src/zmq/zmqpublishnotifier.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp index 21aa44c309..1241431523 100644 --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -97,9 +97,8 @@ static bool IsZMQAddressIPV6(const std::string &zmq_address) const size_t colon_index = zmq_address.rfind(':'); if (tcp_index == 0 && colon_index != std::string::npos) { const std::string ip = zmq_address.substr(tcp_prefix.length(), colon_index - tcp_prefix.length()); - CNetAddr addr; - LookupHost(ip, addr, false); - if (addr.IsIPv6()) return true; + const std::optional<CNetAddr> addr{LookupHost(ip, false)}; + if (addr.has_value() && addr.value().IsIPv6()) return true; } return false; } |