Explorar el Código

完善设备状态获取,启动授权加入fd资源释放情况判定

lishengyin hace 3 años
padre
commit
9c508c809d

+ 3 - 1
CMakeLists.txt

@@ -26,7 +26,8 @@ option(build_Cleaner "build modele Cleaner" ON)
 option(build_monitor "build modele monitor" ON)
 option(build_deviceState "build modele deviceState" ON)
 option(build_Manager "build modele Manager" ON)
-option(WITH_FFMPEG "with ffmpeg" ON)
+option(build_Shell "build modele Shell" ON)
+option(WITH_FFMPEG "with ffmpeg" ON) 
 option(WITH_OPENCV "with opencv" ON)
 option(WITH_ZLMediaKit "with ZLMediaKit" OFF)
 
@@ -164,6 +165,7 @@ include_directories(${PROJECT_SOURCE_DIR}/modules/Cleaner/include/)
 include_directories(${PROJECT_SOURCE_DIR}/modules/monitor/include/)
 include_directories(${PROJECT_SOURCE_DIR}/modules/deviceState/include/)
 include_directories(${PROJECT_SOURCE_DIR}/modules/Manager/include/)
+include_directories(${PROJECT_SOURCE_DIR}/modules/Shell/include/)
 
 include_directories(${ToolKit_Root})
 include_directories(${MediaKit_Root})

BIN
lib/libmodules.so


+ 4 - 0
modules/CMakeLists.txt

@@ -55,6 +55,10 @@ if(build_Manager)
   list(APPEND module_list Manager)
   install(DIRECTORY Manager/include/ DESTINATION include)
 endif()
+if(build_Shell)
+  list(APPEND module_list Shell)
+  install(DIRECTORY Shell/include/ DESTINATION include)
+endif()
 
 if(HAVE_FFMPEG)
   include_directories(${FFMPEG_INCLUDE_DIR})

+ 46 - 3
modules/Manager/include/Manager.h

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 11:47:37
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 14:40:35
+ * @LastEditTime: 2022-01-12 10:39:05
  */
 #pragma once
 
@@ -36,7 +36,6 @@
 #include "inference.h"
 #include "deviceState.h"
 
-
 using namespace toolkit;
 using namespace std;
 
@@ -46,7 +45,37 @@ namespace MIVA{
     private:
         int MemoryThreshold;
         int TempThreshold;
-        
+        int FdThreshold;
+    private:
+
+        /**
+         * @description: 获取fd的判定结果
+         * @param {*}
+         * @return {*}
+         */        
+        bool decideFdResult();
+
+        /**
+         * @description: 获取内存的判定结果
+         * @param {*}
+         * @return {*}
+         */        
+        bool decideMemoryResult();
+
+        /**
+         * @description: 获取温度判定结果
+         * @param {*}
+         * @return {*}
+         */        
+        bool decideTempResult();
+
+        /**
+         * @description: 判定播放的结果
+         * @param {*}
+         * @return {*}
+         */        
+        bool decidePlayResult();
+
     public:
         Manager();
         ~Manager();
@@ -73,6 +102,13 @@ namespace MIVA{
         void setTempThreshold(int tempThreshold);
 
         /**
+         * @description: 设置fd阈值
+         * @param {int} fdThreshold
+         * @return {*}
+         */        
+        void setFdThreshold(int fdThreshold);
+
+        /**
          * @description: 获取启动资格
          * @param {*}
          * @return {*}
@@ -106,6 +142,13 @@ namespace MIVA{
          * @return {*}
          */        
         int32_t getHostDataPower();
+
+        /**
+         * @description: 获取同步FdThreshold的资格
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t getSyncFdThresholdPower();
         
     public:
         using Ptr = std::shared_ptr<Manager>;

+ 77 - 12
modules/Manager/src/Manager.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 11:47:46
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 14:51:57
+ * @LastEditTime: 2022-01-12 11:18:40
  */
 #include "Manager.h"
 
@@ -12,6 +12,8 @@
 namespace MIVA{
 
     std::shared_ptr<Manager> m_manager = nullptr;
+    bool setFdEble = false;
+
     Manager::Manager(){
     }
 
@@ -47,6 +49,15 @@ namespace MIVA{
     }
 
     /**
+     * @description: 设置fd阈值
+     * @param {int} fdThreshold
+     * @return {*}
+     */    
+    void Manager::setFdThreshold(int fdThreshold){
+        if(setFdEble) this->FdThreshold = fdThreshold;
+    }
+
+    /**
      * @description: 获得启动资格
      * @param {*}
      * @return {*}
@@ -57,22 +68,25 @@ namespace MIVA{
         int result = ERR;
         if(Infer == nullptr) return result;
         if(m_deviceState->getDeviceState() != OK) return result;
-        result = !Infer->Play ? OK : ERR;
-        // 内存余量较少,避免内存在未清理完全的时候启动,避免死机
-        if(m_deviceState->MemoryUsage < this-> MemoryThreshold) result = ERR;
+        // 从内存、温度、fd、播放是否停止一起来判定是否可以启动
+        if(decideMemoryResult() && decideTempResult() && decideFdResult() && decidePlayResult()) result = OK;
         return result;
     }
-
+    
     /**
      * @description: 获取停止资格
      * @param {*}
      * @return {*}
      */    
     int32_t Manager::getStopPower(){
+        static int num = 0;
+        if(num == 0){
+            setFdEble = true;
+            num++;
+        } 
         std::shared_ptr<Inference> Infer = Inference::CreateNew();
         if(Infer == nullptr) return ERR;
-        return Infer->Play ? OK : ERR;
-        return OK;
+        return !decidePlayResult() ? OK : ERR;
     }
 
     /**
@@ -81,7 +95,6 @@ namespace MIVA{
      * @return {*}
      */    
     int32_t Manager::getClearPower(){
-        
         return OK;
     }
 
@@ -93,7 +106,7 @@ namespace MIVA{
     int32_t Manager::getSyncDataPower(){
         std::shared_ptr<Inference> Infer = Inference::CreateNew();
         if(Infer == nullptr) return ERR;
-        return !Infer->Play ? OK : ERR;
+        return decidePlayResult() ? OK : ERR;
     }
 
     /**
@@ -104,8 +117,60 @@ namespace MIVA{
     int32_t Manager::getHostDataPower(){
         std::shared_ptr<Inference> Infer = Inference::CreateNew();
         if(Infer == nullptr) return ERR;
-        return !Infer->Play ? OK : ERR;
-    } 
-    
+        return decidePlayResult() ? OK : ERR;
+    }
+
+    /**
+     * @description: 获取同步FdThreshold的资格
+     * @param {*}
+     * @return {*}
+     */        
+    int32_t Manager::getSyncFdThresholdPower(){
+        return setFdEble ? OK : ERR;
+    }
+
+    /**
+     * @description: 
+     * @param {*}
+     * @return {*}
+     */    
+    bool Manager::decideFdResult(){
+        if(!setFdEble) return true;
+        std::shared_ptr<deviceState> m_deviceState = deviceState::CreateNew();
+        if(m_deviceState->FdUsage >= this->FdThreshold){
+           int fd = m_deviceState->FdUsage - this->FdThreshold;
+           if(fd > 2) return false; 
+        }
+        return true;
+    }
+
+    /**
+     * @description: 获取内存的判定结果
+     * @param {*}
+     * @return {*}
+     */    
+    bool Manager::decideMemoryResult(){
+        std::shared_ptr<deviceState> m_deviceState = deviceState::CreateNew();
+        return m_deviceState->MemoryUsage < this-> MemoryThreshold ? false : true;
+    }
+
+    /**
+     * @description: 获取温度的判定结果
+     * @param {*}
+     * @return {*}
+     */    
+    bool Manager::decideTempResult(){
+        return true;
+    }
+
+    /**
+     * @description: 获取播放的结果
+     * @param {*}
+     * @return {*}
+     */    
+    bool Manager::decidePlayResult(){
+        std::shared_ptr<Inference> Infer = Inference::CreateNew();
+        return !Infer->Play ? true : false;
+    }
 }
 

+ 76 - 0
modules/Shell/include/Shell.h

@@ -0,0 +1,76 @@
+/*
+ * @Description: 
+ * @Version: 1.0
+ * @Autor: lishengyin
+ * @Date: 2022-01-11 17:02:51
+ * @LastEditors: lishengyin
+ * @LastEditTime: 2022-01-11 17:19:04
+ */
+
+/*
+*Environment:
+*Linux(Ubuntu), C++11,gcc 7.5.0,g++ 7.5.0
+*Description:
+*执行 Linux shell 命令并获取命令返回值或命令执行结果
+*/
+
+#ifndef PARAMETER_FLOW
+#define PARAMETER_FLOW
+#define IN
+#define OUT
+#define INOUT
+#endif    //PARAMETER_FLOW
+
+#ifndef BASE_TYPE_DEF
+#define BASE_TYPE_DEF
+#include <stdint.h>
+typedef int16_t          SHORT;
+typedef uint16_t         USHORT;
+typedef int32_t          INT;
+typedef uint32_t         UINT;
+typedef int64_t          DLONG;
+typedef uint64_t         DULONG;
+typedef void             VOID;
+typedef bool             BOOL;
+typedef char             CHAR;
+typedef unsigned char    UCHAR;
+typedef float            FLOAT;
+typedef double           DOUBLE;
+#endif    //BASE_TYPE_DEF
+
+#include <string>
+#include <string.h>
+#include <utility>
+#include <vector>
+
+using std::make_pair;
+using std::pair;
+using std::string;
+using std::vector;
+
+class CShell
+{
+public:
+
+    /*
+    *Function    : exeShellCmd
+    *Description : 执行 Linux shell 命令并获取命令返回值
+    *Modify      : 2020.09.17
+    *Input       : IN const string& cmd = "",Linux shell 命令
+    *            : OUT INT* cmdReturnValue = nullptr,命令返回值
+    *Return      : pair<BOOL, string>,<函数是否执行成功,执行失败时的错误信息>
+    *Caution     :
+    */
+    static pair<BOOL, string> exeShellCmd(IN const string& cmd = "", OUT INT* cmdReturnValue = nullptr);
+
+    /*
+    *Function    : exeShellCmd
+    *Description : 执行 Linux shell 命令并获取命令执行结果
+    *Modify      : 2020.09.17
+    *Input       : IN const string& cmd,Linux shell 命令
+    *            : OUT vector<string>& results,命令执行结果
+    *Return      : pair<BOOL, string>,<函数是否执行成功,执行失败时的错误信息>
+    *Caution     :
+    */
+    static pair<BOOL, string> exeShellCmd(IN const string& cmd, OUT vector<string>& results);
+};    //Shell

+ 57 - 0
modules/Shell/src/Shell.cpp

@@ -0,0 +1,57 @@
+/*
+ * @Description: 
+ * @Version: 1.0
+ * @Autor: lishengyin
+ * @Date: 2022-01-11 17:03:06
+ * @LastEditors: lishengyin
+ * @LastEditTime: 2022-01-11 17:19:13
+ */
+#include "Shell.h"
+
+pair<BOOL, string> CShell::exeShellCmd(IN const string &cmd, OUT INT *cmdReturnValue)
+{
+    pid_t status;                 //pid_t 就是 int
+    status = system(cmd.c_str()); //阶段1:创建子进程等准备工作,如果失败返回 -1
+    if (-1 == status)
+    {
+        return make_pair(false, "阶段1:创建子进程等准备工作错误, 错误信息:" + string(strerror(errno)));
+    }
+    else
+    {
+        //阶段2:调用 /bin/sh 拉起脚本执行,如果脚本拉起失败或脚本未正常执行结束,则原因值被写入到 status 的低 8~15 比特位中。
+        //不管脚本中返回什么值,是 0 还是非 0,都算正常执行结束。即使脚本不存在或没有执行权限,也都算正常执行结束。
+        //如果脚本执行过程中被强制 kill 掉等情况则算异常结束。
+        if (WIFEXITED(status))
+        {
+            if (nullptr != cmdReturnValue)
+            {
+                *cmdReturnValue = WEXITSTATUS(status); //获取脚本返回值,一般脚本或命令正确执行返回值是 0,执行错误返回其它值
+            }
+            return make_pair(true, "");
+        }
+        else
+        {
+            return make_pair(false, "阶段2:调用 /bin/sh 拉起脚本(命令)执行,脚本(命令)拉起失败或脚本(命令)未正常执行结束");
+        }
+    }
+} //exeShellCmd()
+
+pair<BOOL, string> CShell::exeShellCmd(IN const string &cmd, OUT vector<string> &results)
+{
+    INT bufferSize = 10240; //10KB应该是非常充足了
+    CHAR *buffer = new CHAR[bufferSize];
+    FILE *pFile = NULL;
+    if (NULL == (pFile = popen(cmd.c_str(), "r")))
+    {
+        return make_pair(false, "execute shell command error");
+    }
+    while (NULL != fgets(buffer, bufferSize, pFile))
+    {
+        buffer[strlen(buffer) - 1] = '\0'; //fgets() 会自动在末尾加入换行符,linux 下换行符就是 \n(LF),这里把自动添加的换行符去掉
+        results.emplace_back(buffer);
+    }
+    delete[] buffer;
+    pclose(pFile);
+    return make_pair(true, "");
+} //exeShellCmd()
+

+ 13 - 2
modules/deviceState/include/deviceState.h

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 10:44:52
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 14:42:56
+ * @LastEditTime: 2022-01-12 11:02:19
  */
 #pragma once
 
@@ -46,7 +46,11 @@ namespace MIVA
         int CpuUsage;
         int GpuUsage;
         int MemoryUsage;
-        int Temp;
+        int CpuTemp;
+        int GpuTemp;
+        int AUXTemp;
+        int A0Temp;
+        int ThermalTemp;
         int FdUsage;
         
     public:
@@ -73,6 +77,13 @@ namespace MIVA
          * @return {*}
          */        
         int32_t SyncDeviceState(std::string& Ctime);
+
+        /**
+         * @description:同步fd阈值 
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t SyncFdThreshold(int sourceNum);
     private:
         mutex m_mutex;
     };

+ 32 - 5
modules/deviceState/src/deviceState.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 10:45:05
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 14:43:10
+ * @LastEditTime: 2022-01-12 11:01:39
  */
 #include "deviceState.h"
 
@@ -43,7 +43,11 @@ namespace MIVA
         this->CpuUsage = m_monitor->getCpuUsage();
         this->GpuUsage = m_monitor->getGpuUsage();
         this->MemoryUsage = m_monitor->getMemoryUsage();
-        this->Temp = m_monitor->getTemp();
+        this->CpuTemp = m_monitor->getCpuTemp();
+        this->GpuTemp = m_monitor->getGpuTemp();
+        this->AUXTemp = m_monitor->getAUXTemp();
+        this->A0Temp = m_monitor->getA0Temp();
+        this->ThermalTemp = m_monitor->getThermalTemp();
         this->FdUsage = m_monitor->getFdUsage();
         
         return 0;
@@ -58,11 +62,34 @@ namespace MIVA
         std::lock_guard<mutex> gurad(m_mutex);
         vector<vector<string>> sqlRet;
 
-        SqlWriter sqlUpdate_DeviceState("UPDATE MIVA_DB.DeviceState SET CpuUsage='?',GpuUsage='?',MemoryUsage='?',Temp='?',FdUsage='?',updateTime='?'");
-        sqlUpdate_DeviceState << this->CpuUsage << this->GpuUsage  << this->MemoryUsage << this->Temp << this->FdUsage  << Ctime << sqlRet;
+        SqlWriter sqlUpdate_DeviceState("UPDATE MIVA_DB.DeviceState SET CpuUsage='?',GpuUsage='?',MemoryUsage='?',CpuTemp='?',GpuTemp='?',FdUsage='?',AUXTemp='?',A0Temp='?',ThermalTemp='?',updateTime='?'");
+        sqlUpdate_DeviceState << this->CpuUsage << this->GpuUsage  << this->MemoryUsage << this->CpuTemp << this->GpuTemp << this->FdUsage << this->AUXTemp << this->A0Temp << this->ThermalTemp << Ctime << sqlRet;
         
         return 0;
-    }   
+    }
+    
+    /**
+     * @description: 同步fd阈值
+     * @param {*}
+     * @return {*}
+     */    
+    int32_t deviceState::SyncFdThreshold(int sourceNum){
+        std::lock_guard<mutex> gurad(m_mutex);
+        static int num = 0;
+        static int fdMin = 3000;
+        if(num != sourceNum){
+            num = sourceNum;
+            fdMin = 3000;
+        }
+        if(this->FdUsage < fdMin) {
+            fdMin = this->FdUsage;
+            vector<vector<string>> sqlRet;
+            SqlWriter sqlUpdate("UPDATE MIVA_DB.MivaConfig SET FdThreshold='?'");
+            sqlUpdate << this->FdUsage << sqlRet;
+            return 0;
+        }
+        return -1;
+    }
 } // namespace MIVA
 
 

+ 32 - 3
modules/monitor/include/monitor.h

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-10 15:01:15
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 11:12:08
+ * @LastEditTime: 2022-01-12 09:30:02
  */
 #pragma once
 
@@ -30,6 +30,7 @@
 #include "Util/SqlPool.h"
 #include "Network/TcpClient.h"
 #include "Poller/Timer.h"
+#include "Shell.h"
 
 using namespace toolkit;
 using namespace std;
@@ -75,12 +76,40 @@ namespace MIVA
         int32_t getCpuUsage();
 
         /**
-         * @description: 获取温度
+         * @description: 获取Cpu温度
          * TODO
          * @param {*}
          * @return {*}
          */      
-        int32_t getTemp();
+        int32_t getCpuTemp();
+
+        /**
+         * @description: 获取GPU温度
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t getGpuTemp();
+
+        /**
+         * @description: 获取AUX温度
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t getAUXTemp();
+
+        /**
+         * @description: 获取AO温度
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t getA0Temp();
+
+        /**
+         * @description: 获取Thermal
+         * @param {*}
+         * @return {*}
+         */        
+        int32_t getThermalTemp();
 
         /**
          * @description: 获取Gpu使用情况

+ 78 - 3
modules/monitor/src/monitor.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-10 15:01:23
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 11:11:53
+ * @LastEditTime: 2022-01-12 09:28:25
  */
 #include <monitor.h>
 
@@ -81,14 +81,83 @@ namespace MIVA
     }
 
     /**
-     * @description: 获取温度
+     * @description: 获取CPU温度
      * TODO
      * @param {*}
      * @return {*}
      */      
-    int32_t monitor::getTemp(){
+    int32_t monitor::getCpuTemp(){
         int32_t temp = 0;
+        string shell = "cat /sys/class/thermal/thermal_zone0/temp";
+        vector<string> results;
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            temp = std::atoi(iter->c_str());
+        }
+        return temp;
+    }
+
+    /**
+     * @description: 获取GPU温度
+     * @param {*}
+     * @return {*}
+     */    
+    int32_t monitor::getGpuTemp(){
+        int32_t temp = 0;
+        string shell = "cat /sys/devices/virtual/thermal/thermal_zone1/temp";
+        vector<string> results;
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            temp = std::atoi(iter->c_str());
+        }
+        return temp;
+    }
 
+    /**
+     * @description: 获取AUX的温度
+     * @param {*}
+     * @return {*}
+     */    
+    int32_t monitor::getAUXTemp(){
+        int32_t temp = 0;
+        string shell = "cat /sys/devices/virtual/thermal/thermal_zone2/temp";
+        vector<string> results;
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            temp = std::atoi(iter->c_str());
+        }
+        return temp;
+    }
+
+    /**
+     * @description: 获取A0的温度
+     * @param {*}
+     * @return {*}
+     */    
+    int32_t monitor::getA0Temp(){
+        int32_t temp = 0;
+        string shell = "cat /sys/devices/virtual/thermal/thermal_zone3/temp";
+        vector<string> results;
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            temp = std::atoi(iter->c_str());
+        }
+        return temp;
+    }
+
+    /**
+     * @description: 获取Thermal的温度
+     * @param {*}
+     * @return {*}
+     */    
+    int32_t monitor::getThermalTemp(){
+        int32_t temp = 0;
+        string shell = "cat /sys/devices/virtual/thermal/thermal_zone5/temp";
+        vector<string> results;
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            temp = std::atoi(iter->c_str());
+        }
         return temp;
     }
 
@@ -99,7 +168,13 @@ namespace MIVA
      */    
     int32_t monitor::getFdUsage(){
         int32_t fdUsage = 0;
+        string shell = "lsof -p $(pidof main) | wc -l";
+        vector<string> results;
 
+        CShell::exeShellCmd(shell, results);
+        for(auto iter = results.begin(); iter != results.end(); iter++){
+            fdUsage = std::atoi(iter->c_str());
+        }
         return fdUsage;
     }
 } // namespace MIVA

+ 10 - 7
modules/userApp/src/user_app.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2021-10-13 09:35:42
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-11 14:54:04
+ * @LastEditTime: 2022-01-12 11:31:45
  */
 #include "user_app.h"
 
@@ -98,7 +98,7 @@ namespace MIVA
         this->m_manager = Manager::CreateNew();
 
         // 查询基础配置
-        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold FROM MIVA_DB.`MivaConfig`");
+        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold FROM MIVA_DB.`MivaConfig`");
         sqlSelectConfig << sqlRet;
         for(auto &line : sqlRet)
         {
@@ -111,6 +111,7 @@ namespace MIVA
             this->m_Cleaner->validTime = std::atoi(line[6].c_str());
             this->m_manager->setMemoryThreshold(std::atoi(line[7].c_str()));
             this->m_manager->setTempThreshold(std::atoi(line[8].c_str()));
+            this->m_manager->setFdThreshold(std::atoi(line[9].c_str()));
         }
 
         // 链接Netty后端
@@ -512,7 +513,7 @@ namespace MIVA
             {  
                 // 广播收到关门的信号
                 if(this->m_manager->getStartPower() == OK) this->ListenClosed();
-                else WarnL << "推理未结束或内存所剩不足" << endl;
+                else WarnL << "推理未结束或内存所剩不足或资源未释放完全" << endl;
             }
         }
     }
@@ -559,12 +560,12 @@ namespace MIVA
         char ctime[80];
         getDataTime(ctime);
         std::string Ctime = ctime;
-
         // 设备数据
         this->m_deviceState->getDeviceState();
         this->m_deviceState->SyncDeviceState(Ctime);
-        
-        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold FROM MIVA_DB.`MivaConfig`");
+        if(this->m_manager->getSyncFdThresholdPower() == OK) this->m_deviceState->SyncFdThreshold((int)this->m_InferInfo->DataSources.size());  
+
+        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold FROM MIVA_DB.`MivaConfig`");
         sqlSelectConfig << sqlRet;
         for(auto &line : sqlRet)
         {
@@ -577,6 +578,7 @@ namespace MIVA
             this->m_Cleaner->validTime = std::atoi(line[6].c_str());
             this->m_manager->setMemoryThreshold(std::atoi(line[7].c_str()));
             this->m_manager->setTempThreshold(std::atoi(line[8].c_str()));
+            this->m_manager->setFdThreshold(std::atoi(line[9].c_str()));
         }
         
         if(this->m_Infer->enable == false || this->m_InferInfo->DataSources.empty()){
@@ -664,9 +666,10 @@ namespace MIVA
             }
             // 清除数据
             this->m_InferInfo->DataSources.clear();
-        }        
+        }      
     }
 
+
     /**
      * @description: 赋值struct sockaddr
      * @param {sockaddr} *out

BIN
source/bin/main