diff options
-rw-r--r-- | libwifi_system/hostapd_manager.cpp | 35 | ||||
-rw-r--r-- | libwifi_system/include/wifi_system/hostapd_manager.h | 7 |
2 files changed, 0 insertions, 42 deletions
diff --git a/libwifi_system/hostapd_manager.cpp b/libwifi_system/hostapd_manager.cpp index 56951613a..b92c56bed 100644 --- a/libwifi_system/hostapd_manager.cpp +++ b/libwifi_system/hostapd_manager.cpp @@ -47,7 +47,6 @@ namespace { const int kDefaultApChannel = 6; const char kHostapdServiceName[] = "hostapd"; const char kHostapdConfigFilePath[] = "/data/misc/wifi/hostapd.conf"; -const char kHostapdPidFile[] = "/data/misc/wifi/hostapd.pid"; string GeneratePsk(const vector<uint8_t>& ssid, @@ -82,8 +81,6 @@ bool HostapdManager::StartHostapd() { LOG(WARNING) << "Wi-Fi entropy file was not created"; } - unlink(kHostapdPidFile); - if (property_set("ctl.start", kHostapdServiceName) != 0) { LOG(ERROR) << "Failed to start SoftAP"; return false; @@ -93,36 +90,6 @@ bool HostapdManager::StartHostapd() { return true; } -bool HostapdManager::IsHostapdRunning() { - pid_t hostapd_pid; - if (!GetHostapdPid(&hostapd_pid)) { - return false; - } - - if (kill(hostapd_pid, 0) != 0) { - LOG(DEBUG) << "hostapd has already died."; - return false; - } - - return true; -} - -bool HostapdManager::GetHostapdPid(pid_t* hostapd_pid) { - string pid_string; - if (!ReadFileToString(kHostapdPidFile, &pid_string)) { - LOG(DEBUG) << "Failed to read hostapd pid file."; - return false; - } - pid_t pid = 0; - if (!ParseInt(pid_string.c_str(), &pid) || pid <= 0) { - LOG(DEBUG) << "hostapd pid file contained bad pid: " << pid_string; - return false; - } - - *hostapd_pid = pid; - return true; -} - bool HostapdManager::StopHostapd() { LOG(DEBUG) << "Stopping the SoftAP service..."; @@ -131,8 +98,6 @@ bool HostapdManager::StopHostapd() { return false; } - unlink(kHostapdPidFile); - LOG(DEBUG) << "SoftAP stopped successfully"; return true; } diff --git a/libwifi_system/include/wifi_system/hostapd_manager.h b/libwifi_system/include/wifi_system/hostapd_manager.h index 9b52711e0..485267078 100644 --- a/libwifi_system/include/wifi_system/hostapd_manager.h +++ b/libwifi_system/include/wifi_system/hostapd_manager.h @@ -40,13 +40,6 @@ class HostapdManager { // Returns true on success. virtual bool StartHostapd(); - // Returns true if hostapd is currently running. - virtual bool IsHostapdRunning(); - - // Returns true if hostapd is running, false otherwise. - // When true is returned, will write hostapd's pid to |hostapd_pid|. - virtual bool GetHostapdPid(pid_t* hostapd_pid); - // Request that a running instance of hostapd be stopped. // Returns true on success. virtual bool StopHostapd(); |