adb: improve network_connect error messages.
Test: manual Change-Id: If8747ba1951d3c87561fbd3fb4968821243b2ee2
This commit is contained in:
parent
eb0875db65
commit
64e597a62f
|
@ -24,6 +24,7 @@
|
|||
#include <string>
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <cutils/sockets.h>
|
||||
|
||||
#include "adb_unique_fd.h"
|
||||
|
@ -136,11 +137,13 @@ int network_connect(const std::string& host, int port, int type, int timeout, st
|
|||
return fd;
|
||||
}
|
||||
if (getaddrinfo_error != 0) {
|
||||
*error = gai_strerror(getaddrinfo_error);
|
||||
LOG(WARNING) << "failed to resolve host '" << host << "': " << *error;
|
||||
*error = android::base::StringPrintf("failed to resolve host: '%s': %s", host.c_str(),
|
||||
gai_strerror(getaddrinfo_error));
|
||||
LOG(WARNING) << *error;
|
||||
} else {
|
||||
*error = strerror(errno);
|
||||
LOG(WARNING) << "failed to connect to '" << host << "': " << *error;
|
||||
*error = android::base::StringPrintf("failed to connect to '%s:%d': %s", host.c_str(), port,
|
||||
strerror(errno));
|
||||
LOG(WARNING) << *error;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue