shill: No longer trying to reconnect to 'current_service_'.
BUG=chromium-os:34656
TEST=Hand traced the code.
Change-Id: I80b97eaf7b130ced78388795650f1ccd0730e0d2
Reviewed-on: https://gerrit.chromium.org/gerrit/37072
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Wade Guthrie <wdg@google.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Wade Guthrie <wdg@google.com>
diff --git a/wifi.h b/wifi.h
index bfcee09..b80edf1 100644
--- a/wifi.h
+++ b/wifi.h
@@ -161,6 +161,10 @@
// Called by Linkmonitor (overriden from Device superclass).
virtual void OnLinkMonitorFailure();
+ bool IsCurrentService(const WiFiServiceRefPtr service) {
+ return service.get() == current_service_.get();
+ }
+
// Overriden from Device superclass
virtual std::vector<GeolocationInfo> GetGeolocationObjects() const;
diff --git a/wifi_service.cc b/wifi_service.cc
index 17fbffe..904fa9b 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -391,6 +391,15 @@
Error::GetDefaultMessage(Error::kAlreadyConnected));
return;
}
+ if (wifi_->IsCurrentService(this)) {
+ LOG(WARNING) << "Can't connect. Service " << friendly_name()
+ << " is the current service (but, in " << GetStateString()
+ << " state, not connected.";
+ Error::PopulateAndLog(error,
+ Error::kInProgress,
+ Error::GetDefaultMessage(Error::kInProgress));
+ return;
+ }
params[wpa_supplicant::kNetworkPropertyMode].writer().
append_uint32(WiFiEndpoint::ModeStringToUint(mode_));