diff options
author | Patric Stout <truebrain@openttd.org> | 2021-08-28 21:19:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-28 21:19:53 +0200 |
commit | d8e870c50c8c4bc57701a5a0bc2cb56e484a754e (patch) | |
tree | a8b62d5bcd706bfbe4a2dddef2043887a7e17c42 | |
parent | 13b53e1290d090f76d337241ffa681e63bab20e8 (diff) | |
download | openttd-d8e870c50c8c4bc57701a5a0bc2cb56e484a754e.tar.xz |
Fix: when DNS didn't resolve any IPs, the debug message was misleading (#9519)
-rw-r--r-- | src/network/core/tcp_connect.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp index 29e9048d9..73c6aa90d 100644 --- a/src/network/core/tcp_connect.cpp +++ b/src/network/core/tcp_connect.cpp @@ -205,9 +205,13 @@ void TCPConnecter::OnResolved(addrinfo *ai) } if (_debug_net_level >= 6) { - Debug(net, 6, "{} resolved in:", this->connection_string); - for (const auto &address : this->addresses) { - Debug(net, 6, "- {}", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString()); + if (this->addresses.size() == 0) { + Debug(net, 6, "{} did not resolve", this->connection_string); + } else { + Debug(net, 6, "{} resolved in:", this->connection_string); + for (const auto &address : this->addresses) { + Debug(net, 6, "- {}", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString()); + } } } |