Fix: when DNS didn't resolve any IPs, the debug message was misleading (#9519)

This commit is contained in:
Patric Stout 2021-08-28 21:19:53 +02:00 committed by GitHub
parent 13b53e1290
commit d8e870c50c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,11 +205,15 @@ void TCPConnecter::OnResolved(addrinfo *ai)
} }
if (_debug_net_level >= 6) { if (_debug_net_level >= 6) {
if (this->addresses.size() == 0) {
Debug(net, 6, "{} did not resolve", this->connection_string);
} else {
Debug(net, 6, "{} resolved in:", this->connection_string); Debug(net, 6, "{} resolved in:", this->connection_string);
for (const auto &address : this->addresses) { for (const auto &address : this->addresses) {
Debug(net, 6, "- {}", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString()); Debug(net, 6, "- {}", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString());
} }
} }
}
this->current_address = 0; this->current_address = 0;
} }