mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-07 13:13:24 +02:00
Misc logging improvements
This commit is contained in:
@@ -48,6 +48,19 @@ inline unsigned short myhtons(unsigned short x) {
|
||||
return (x >> 8) | (x << 8);
|
||||
}
|
||||
|
||||
const char *DNSTypeAsString(DNSType type) {
|
||||
switch (type) {
|
||||
case DNSType::IPV4:
|
||||
return "IPV4";
|
||||
case DNSType::IPV6:
|
||||
return "IPV6";
|
||||
case DNSType::ANY:
|
||||
return "ANY";
|
||||
default:
|
||||
return "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
bool Connection::Resolve(const char *host, int port, DNSType type) {
|
||||
if ((intptr_t)sock_ != -1) {
|
||||
ERROR_LOG(IO, "Resolve: Already have a socket");
|
||||
@@ -66,8 +79,8 @@ bool Connection::Resolve(const char *host, int port, DNSType type) {
|
||||
|
||||
std::string err;
|
||||
if (!net::DNSResolve(host, port_str, &resolved_, err, type)) {
|
||||
ERROR_LOG(IO, "Failed to resolve host %s: %s", host, err.c_str());
|
||||
// So that future calls fail.
|
||||
WARN_LOG(IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type));
|
||||
// Zero port so that future calls fail.
|
||||
port_ = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user