Skip to content

Commit

Permalink
[Chromecast] Always re-trigger connectivity check on success
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
prashanthswami authored and Commit Bot committed Apr 19, 2018
1 parent 94651a5 commit a2ad0a9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions chromecast/net/connectivity_checker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a2ad0a9

Please sign in to comment.