Commit 207b3ee8 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Speed up DevTools connection on Windows

While connecting to DevTools on localhost, try using IPv4 first,
since DevTools prefer IPv4 over IPv6.

Change-Id: I7e960789fe8268e850d4eb9cb9928ecc26cab8fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2523468Reviewed-by: default avatarShengfa Lin <shengfa@google.com>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825630}
parent 4e3583c4
...@@ -99,10 +99,14 @@ void WebSocket::Connect(net::CompletionOnceCallback callback) { ...@@ -99,10 +99,14 @@ void WebSocket::Connect(net::CompletionOnceCallback callback) {
} }
if (url_.host() == "localhost") { if (url_.host() == "localhost") {
// ensure that both localhost addresses are included // Ensure that both localhost addresses are included.
// see https://bugs.chromium.org/p/chromedriver/issues/detail?id=3316 // See https://bugs.chromium.org/p/chromedriver/issues/detail?id=3316.
addresses.push_back(net::IPEndPoint(net::IPAddress::IPv4Localhost(), port)); // Put IPv4 address at front, followed by IPv6 address, since that is
addresses.push_back(net::IPEndPoint(net::IPAddress::IPv6Localhost(), port)); // the ordering used by DevTools.
addresses.endpoints().insert(
addresses.begin(),
{net::IPEndPoint(net::IPAddress::IPv4Localhost(), port),
net::IPEndPoint(net::IPAddress::IPv6Localhost(), port)});
addresses.Deduplicate(); addresses.Deduplicate();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment