Commit 973c0eef authored by Edward Wang's avatar Edward Wang Committed by Commit Bot

Use http protocol for periodic connectivity check

Https is quite heavy for periodic connectivity check. Change to http
version to reduce the server load after initial https check passsed.

Bug: b/135769650
Test: Verified the check change to http one after last check succeed.
Change-Id: I73d0c9ffaa6a22d0319d6782ed17ee1152045894
Signed-off-by: default avatarEdward Wang <wangedward@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677263Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672661}
parent a44ad101
......@@ -47,6 +47,10 @@ const unsigned int kRequestTimeoutInSeconds = 3;
const char kDefaultConnectivityCheckUrl[] =
"https://connectivitycheck.gstatic.com/generate_204";
// Http url for connectivity checking.
const char kHttpConnectivityCheckUrl[] =
"http://connectivitycheck.gstatic.com/generate_204";
// Delay notification of network change events to smooth out rapid flipping.
// Histogram "Cast.Network.Down.Duration.In.Seconds" shows 40% of network
// downtime is less than 3 seconds.
......@@ -119,6 +123,17 @@ void ConnectivityCheckerImpl::SetConnected(bool connected) {
base::AutoLock auto_lock(connected_lock_);
connected_ = connected;
}
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::CommandLine::StringType check_url_str =
command_line->GetSwitchValueNative(switches::kConnectivityCheckUrl);
if (check_url_str.empty())
{
connectivity_check_url_.reset(new GURL(
connected ? kHttpConnectivityCheckUrl : kDefaultConnectivityCheckUrl));
LOG(INFO) << "Change check url=" << *connectivity_check_url_;
}
Notify(connected);
LOG(INFO) << "Global connection is: " << (connected ? "Up" : "Down");
}
......
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