0

[Chromecast] Always re-trigger connectivity check on success

After connecting to the internet once, connectivity isn't checked again
until a network change occurs, except on audio-only devices. This
results in a slow reaction to scenarios where we lose connectivity to
the internet, but do not lose our association to the access point.

This change removes the guard to perform the re-triggering of the
connectivity check for audio-only devices, and now does this check for
all devices.

Bug: internal b/76446094
Test: Successful OOBE and connectivity check fires every minute.
Change-Id: Ic6ce73331b481af05ad659edd9e19d8ca2f5d4b9
Reviewed-on: https://chromium-review.googlesource.com/1018363
Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
Reviewed-by: Bailey Forrest <bcf@chromium.org>
Reviewed-by: Luke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552060}
This commit is contained in:
Prashanth Swaminathan
2018-04-19 17:21:41 +00:00
committed by Commit Bot
parent 94651a5239
commit a2ad0a98e8

@ -32,10 +32,8 @@ namespace {
// How often connectivity checks are performed in seconds while not connected.
const unsigned int kConnectivityPeriodSeconds = 1;
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
// How often connectivity checks are performed in seconds while connected.
const unsigned int kConnectivitySuccessPeriodSeconds = 60;
#endif
// Number of consecutive connectivity check errors before status is changed
// to offline.
@ -190,14 +188,11 @@ void ConnectivityCheckerImpl::OnResponseStarted(net::URLRequest* request,
VLOG(1) << "Connectivity check succeeded";
check_errors_ = 0;
SetConnected(true);
#if BUILDFLAG(IS_CAST_AUDIO_ONLY)
// Audio products do not have an idle screen that makes periodic network
// requests. Schedule another check for audio devices to make sure
// connectivity hasn't dropped.
// Some products don't have an idle screen that makes periodic network
// requests. Schedule another check to ensure connectivity hasn't dropped.
task_runner_->PostDelayedTask(
FROM_HERE, base::Bind(&ConnectivityCheckerImpl::CheckInternal, this),
base::TimeDelta::FromSeconds(kConnectivitySuccessPeriodSeconds));
#endif
timeout_.Cancel();
return;
}