Commit 4b66e0b1 authored by Hugo Benichi's avatar Hugo Benichi Committed by Commit Bot

arc: net: fix bug when the last connected network disconnects

Change-Id If3e511212f491a5ec6533c8fb259c49eab29295b introduced a
regression when the last connected network is disconnected: depending of
the exact order of internal callback events in ArcNetHostImpl, it can
happen that ARC never learns about the disconnection event.

This patch ensures that when the list of active networks becomes empty,
ARC receives an event about it.

BUG=b:162904019
BUG=b:159667565
TEST=Compiled, flashed rammus, tested disconnecting wifi with no
ethernet connected and confirmed that ARC disconnects the network inside
Android.

Change-Id: Ifcb984f5942d0d132e277a8699fb1f3b43e5b72d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2336245
Commit-Queue: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795822}
parent 2b9639bc
...@@ -897,7 +897,14 @@ void ArcNetHostImpl::NetworkListChanged() { ...@@ -897,7 +897,14 @@ void ArcNetHostImpl::NetworkListChanged() {
return !IsActiveNetworkState( return !IsActiveNetworkState(
GetStateHandler()->GetNetworkState(entry.first)); GetStateHandler()->GetNetworkState(entry.first));
}); });
for (const auto* network : GetActiveNetworks()) const auto active_networks = GetActiveNetworks();
// If there is no active networks, send an explicit ActiveNetworksChanged
// event to ARC and skip updating Shill properties.
if (active_networks.empty()) {
UpdateActiveNetworks();
return;
}
for (const auto* network : active_networks)
NetworkPropertiesUpdated(network); NetworkPropertiesUpdated(network);
} }
......
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