Log(LogInformation, "ApiListener")
<< "'" << GetName() << "' stopped.";
- boost::mutex::scoped_lock lock(m_LogLock);
- CloseLogFile();
+ {
+ boost::mutex::scoped_lock lock(m_LogLock);
+ CloseLogFile();
+ }
+
+ RemoveStatusFile();
}
ApiListener::Ptr ApiListener::GetInstance()
{"port", details.second}
}));
}
+
+void ApiListener::RemoveStatusFile()
+{
+ String path = Application::GetConst("CacheDir") + "/api-state.json";
+
+ if (Utility::PathExists(path)) {
+ if (unlink(path.CStr()) < 0 && errno != ENOENT) {
+ BOOST_THROW_EXCEPTION(posix_error()
+ << boost::errinfo_api_function("unlink")
+ << boost::errinfo_errno(errno)
+ << boost::errinfo_file_name(path));
+ }
+ }
+}
void Start(bool runtimeCreated) override;
void Stop(bool runtimeDeleted) override;
- void UpdateStatusFile(TcpSocket::Ptr socket);
-
void ValidateTlsProtocolmin(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
private:
static void CopyCertificateFile(const String& oldCertPath, const String& newCertPath);
+ void UpdateStatusFile(TcpSocket::Ptr socket);
+ void RemoveStatusFile();
+
/* filesync */
static ConfigDirInformation LoadConfigDir(const String& dir);
static Dictionary::Ptr MergeConfigUpdate(const ConfigDirInformation& config);