aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-02-29 21:08:30 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-29 21:08:30 +0000
commit18015e7505485871dbdc117e49949f8c11eeedc6 (patch)
tree39f5a9a7622e4ab2dad18fb23935156b230b5cbd
parentb23c87ebe202d7fd183d32fedce2ec10084ce713 (diff)
parent5645f15604d06e3bc5663c272843a2465b08a8a6 (diff)
downloadweaved-18015e7505485871dbdc117e49949f8c11eeedc6.tar.gz
Remove connectivity_state_ member am: 026dce2bce
am: 5645f15604 * commit '5645f15604d06e3bc5663c272843a2465b08a8a6': Remove connectivity_state_ member
-rw-r--r--buffet/shill_client.cc23
-rw-r--r--buffet/shill_client.h1
2 files changed, 7 insertions, 17 deletions
diff --git a/buffet/shill_client.cc b/buffet/shill_client.cc
index 88fbc84..dea039d 100644
--- a/buffet/shill_client.cc
+++ b/buffet/shill_client.cc
@@ -123,7 +123,6 @@ void ShillClient::Init() {
VLOG(2) << "ShillClient::Init();";
CleanupConnectingService();
devices_.clear();
- connectivity_state_ = Network::State::kOffline;
VariantDictionary properties;
if (!manager_proxy_.GetProperties(&properties, nullptr)) {
LOG(ERROR) << "Unable to get properties from Manager, waiting for "
@@ -198,7 +197,12 @@ void ShillClient::ConnectToServiceError(
}
Network::State ShillClient::GetConnectionState() const {
- return connectivity_state_;
+ Network::State new_connectivity_state{Network::State::kOffline};
+ for (const auto& kv : devices_) {
+ new_connectivity_state =
+ std::max(new_connectivity_state, kv.second.service_state);
+ }
+ return new_connectivity_state;
}
void ShillClient::StartAccessPoint(const std::string& ssid) {
@@ -239,7 +243,6 @@ void ShillClient::OnShillServiceOwnerChange(const string& /*old_owner*/,
if (new_owner.empty()) {
CleanupConnectingService();
devices_.clear();
- connectivity_state_ = Network::State::kOffline;
} else {
Init(); // New service owner means shill reset!
}
@@ -553,19 +556,7 @@ void ShillClient::OnStateChangeForSelectedService(
}
void ShillClient::UpdateConnectivityState() {
- // Update the connectivity state of the device by picking the
- // state of the currently most connected selected service.
- Network::State new_connectivity_state{Network::State::kOffline};
- for (const auto& kv : devices_) {
- if (kv.second.service_state > new_connectivity_state) {
- new_connectivity_state = kv.second.service_state;
- }
- }
- VLOG(1) << "Connectivity changed: " << EnumToString(connectivity_state_)
- << " -> " << EnumToString(new_connectivity_state);
- // Notify listeners even if state changed to the same value. Listeners may
- // want to handle this event.
- connectivity_state_ = new_connectivity_state;
+ VLOG(1) << "Connectivity state: " << EnumToString(GetConnectionState());
// We may call UpdateConnectivityState whenever we mutate a data structure
// such that our connectivity status could change. However, we don't want
// to allow people to call into ShillClient while some other operation is
diff --git a/buffet/shill_client.h b/buffet/shill_client.h
index 12fd619..6407a33 100644
--- a/buffet/shill_client.h
+++ b/buffet/shill_client.h
@@ -130,7 +130,6 @@ class ShillClient final : public weave::provider::Network,
// State for tracking our online connectivity.
std::map<dbus::ObjectPath, DeviceState> devices_;
- State connectivity_state_{State::kOffline};
std::unique_ptr<ApManagerClient> ap_manager_client_;