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
diff --git a/service.cc b/service.cc
index 09af33a..cd8a0e1 100644
--- a/service.cc
+++ b/service.cc
@@ -325,13 +325,16 @@
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,