Chromium Code Reviews| Index: chrome/test/chromedriver/net/adb_client_socket.cc |
| diff --git a/chrome/test/chromedriver/net/adb_client_socket.cc b/chrome/test/chromedriver/net/adb_client_socket.cc |
| index 9a5a672c6bc7e69fc06f35237c67cd837b01f100..05478c9f517a42842fec280733c6f3e97898ee36 100644 |
| --- a/chrome/test/chromedriver/net/adb_client_socket.cc |
| +++ b/chrome/test/chromedriver/net/adb_client_socket.cc |
| @@ -365,8 +365,16 @@ AdbClientSocket::~AdbClientSocket() { |
| } |
| void AdbClientSocket::Connect(const net::CompletionCallback& callback) { |
| - net::AddressList address_list = net::AddressList::CreateFromIPAddress( |
| - net::IPAddress::IPv4Localhost(), port_); |
| + // getaddrinfo for localhost could only return IPv6 address in a IPv4/IPv6 |
| + // dual stack environment while current adb (1.0.36) always listen on IPv4. |
|
samuong
2016/09/23 10:01:15
I'd suggest the following tweak to the wording to
|
| + // So just try IPv4 first, then fall back to IPv6. |
| + net::IPAddressList list = {net::IPAddress::IPv4Localhost(), |
| + net::IPAddress::IPv6Localhost()}; |
| + net::AddressList ip_list = net::AddressList::CreateFromIPAddressList( |
| + list, "localhost"); |
| + net::AddressList address_list = net::AddressList::CopyWithPort( |
| + ip_list, port_); |
| + |
| socket_.reset(new net::TCPClientSocket(address_list, NULL, NULL, |
| net::NetLog::Source())); |
| int result = socket_->Connect(callback); |