summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-08-28 21:19:53 +0200
committerGitHub <noreply@github.com>2021-08-28 21:19:53 +0200
commitd8e870c50c8c4bc57701a5a0bc2cb56e484a754e (patch)
treea8b62d5bcd706bfbe4a2dddef2043887a7e17c42 /src/network
parent13b53e1290d090f76d337241ffa681e63bab20e8 (diff)
downloadopenttd-d8e870c50c8c4bc57701a5a0bc2cb56e484a754e.tar.xz
Fix: when DNS didn't resolve any IPs, the debug message was misleading (#9519)
Diffstat (limited to 'src/network')
-rw-r--r--src/network/core/tcp_connect.cpp10
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());
+ }
}
}