summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Qiu <zqiu@google.com>2015-11-16 09:22:34 -0800
committerPeter Qiu <zqiu@google.com>2015-11-16 09:22:34 -0800
commit31f7086eadd1e9391ef9acf4b3a9174f284112fe (patch)
tree8ec972fb5d3919779f89b08bfe0d4950c17cd6b1
parent58083964e47533d2850340a09884edc22348c5c4 (diff)
downloadapmanager-31f7086eadd1e9391ef9acf4b3a9174f284112fe.tar.gz
Release interface after station mode interface setup is completed
This avoids a possible race condition where the interface gets enumerated by shill before it is setup as station mode, resulting in the interface being ignored by shill. Bug: 25704767 TEST=Verify device setup on Edison board Change-Id: If1ef2840273d84ba39d2796ac9b09a5707b319e7
-rw-r--r--service.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/service.cc b/service.cc
index 09af33a..cd8a0e1 100644
--- a/service.cc
+++ b/service.cc
@@ -325,13 +325,16 @@ void Service::ReleaseResources() {
hostapd_monitor_.reset();
StopHostapdProcess();
dhcp_server_.reset();
- config_->ReleaseDevice();
manager_->ReleaseDHCPPortAccess(config_->selected_interface());
#if defined(__BRILLO__)
// Restore station mode interface.
string station_mode_interface;
manager_->SetupStationModeInterface(&station_mode_interface);
#endif // __BRILLO__
+ // Only release device after mode switching had completed, to
+ // make sure the station mode interface gets enumerated by
+ // shill.
+ config_->ReleaseDevice();
}
void Service::HostapdEventCallback(HostapdMonitor::Event event,