Improve:Ipc config module.

This commit is contained in:
Fancy code 2024-05-23 22:02:19 +08:00
parent 9c371dfe19
commit 69e69ba86e

View File

@ -14,6 +14,9 @@
*/
#include "IpcConfigImpl.h"
#include "ILog.h"
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define CHECK_MAP(map) (map.size() == 1 ? true : false)
@ -463,10 +466,12 @@ void IpcConfigImpl::ReadingConfigThread(void)
*lastSlash = '\0';
}
mThreadRuning = true;
DIR *dir = nullptr;
LogInfo("Reading config thread is running.dirPath = %s\n", dirPath);
while (mThreadRuning) {
constexpr int FIEL_EXIST = 0;
if (FIEL_EXIST == access(dirPath, F_OK)) {
dir = opendir(dirPath);
if (nullptr != dir) {
closedir(dir);
memset(&mAllData, 0, sizeof(Config_s));
mCfg = OpenConfigFile(IPC_CONFIG_FILE_PATH);
if (nullptr == mCfg) {