This commit is contained in:
zhouhuang 2025-01-10 09:12:01 +08:00
parent 8a7cc6dc46
commit 5c2ff8bb3d
7 changed files with 31 additions and 32 deletions

View File

@ -20,7 +20,7 @@ if (USE_SQLITE3)
endif ()
endif ()
set (CMAKE_BUILD_TYPE Release)
# set (CMAKE_BUILD_TYPE Release)
option (USE_32BITS "Build 32Bits application?" OFF)
if (USE_32BITS)

View File

@ -2829,10 +2829,12 @@ void CRYDevice::heart_beat(int status)
#endif
jsonValue["linkId"] = linkId;
jsonValue["online"] = (config.processes[i].real_softdog >= PROCESS_WATCHDOG_TIME) ? false : true;
#if 1
jsonValue["real"] = (config.processes[i].real_softdog >= PROCESS_WATCHDOG_TIME) ? false : true;
if ((config.processes[i].state & 0x20) == 0x20) {
jsonValue["ftp"] = (config.processes[i].real_softdog >= PROCESS_WATCHDOG_TIME) ? false : true;
}
#endif
jsonLink.append(jsonValue);
}
}
@ -2853,6 +2855,12 @@ void CRYDevice::heart_beat(int status)
#endif
jsonValue["deviceId"] = deviceId;
jsonValue["online"] = (config.units[i].real_softdog >= UNIT_WATCHDOG_TIME) ? false : true;
#if 0
jsonValue["real"] = (config.units[i].real_softdog >= UNIT_WATCHDOG_TIME) ? false : true;
if ((config.units[i].state & 0x20) == 0x20) {
jsonValue["ftp"] = (config.units[i].real_softdog >= UNIT_WATCHDOG_TIME) ? false : true;
}
#endif
jsonDevice.append(jsonValue);
}
}

View File

@ -1741,14 +1741,7 @@ void CProcess::Destroy(void)
{
m_bRunFlag = FALSE;
char name[16];
memset(name, '\0', sizeof(name));
if (pthread_getname_np(m_pid, name, sizeof(name)) != 0)
{
memset(name, '\0', sizeof(name));
}
vLog(LOG_DEBUG, "waiting for protocol thread [%d,%s] destroy.\n", m_nProcess, (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "waiting for protocol thread [%d,%s] destroy.\n", m_nProcess, config.processes[m_nProcess].name);
pthread_join(m_pid, NULL);
int i = 0;
@ -1757,7 +1750,7 @@ void CProcess::Destroy(void)
DestroyItem(i, FALSE);
}
vLog(LOG_DEBUG, "current protocol thread [%d,%s] is destroyed.\n", m_nProcess, (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "current protocol thread [%d,%s] is destroyed.\n", m_nProcess, config.processes[m_nProcess].name);
}
BOOLEAN CProcess::Run(void)

View File

@ -703,15 +703,10 @@ CHostADSBFProcess::~CHostADSBFProcess()
fwrite(&m_currentDirStartFileNo, sizeof(LONG), 1, pf);
fclose(pf);
}
char name[16];
memset(name, '\0', sizeof(name));
if (pthread_getname_np(m_cpid, name, sizeof(name)) != 0)
{
memset(name, '\0', sizeof(name));
}
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (m_cpidName[0] != '\0') ? m_cpidName : "unknow");
pthread_join(m_cpid, NULL);
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (m_cpidName[0] != '\0') ? m_cpidName : "unknow");
}
}
@ -857,14 +852,17 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
//需要给单元添加一个是否有ftp数据的标识
int uid = GetCurUnitID();
if (uid < 0 || uid >= UNIT_NUM) return FALSE;
//if (uid < 0 || uid >= UNIT_NUM) return FALSE;
if (m_bHaveFTP) {
config.units[uid].state |= 0x20; //存在ftp标识
if (uid >= 0 && uid < UNIT_NUM)
{
config.units[uid].state |= 0x20; //存在ftp标识
}
config.processes[id].state |= 0x20;
}
calc();
//vLog(LOG_DEBUG, "%s local ip is: %s, netid is: %s, remote ip is: %s, and netid is: %s\n", m_pidName.c_str(), m_localIp.c_str(), m_localNetId.c_str(), m_remoteIp.c_str(), m_remoteNetId.c_str());
vLog(LOG_DEBUG, "%s local ip is: %s, netid is: %s, remote ip is: %s, and netid is: %s\n", m_pidName.c_str(), m_localIp.c_str(), m_localNetId.c_str(), m_remoteIp.c_str(), m_remoteNetId.c_str());
m_turbine = NULL;
m_bRouteAdded = FALSE;
@ -911,9 +909,8 @@ BOOLEAN CHostADSBFProcess::OnPreCreate(int id)
vLog(LOG_ERROR, "ads create ryftp_process error(%d,%s).\n", errno, strerror(errno));
return TRUE;
}
char name[17];
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
pthread_setname_np(m_cpid, name);
snprintf(m_cpidName, 16, "%s_ftp", m_pidName.c_str());
pthread_setname_np(m_cpid, m_cpidName);
pthread_attr_destroy(&attr);
}

View File

@ -103,8 +103,8 @@ private:
public:
std::string m_pidName;
BOOLEAN m_bHaveFTP; //存在FTP协议
char m_cpidName[16];
//ftp参数信息
char m_user[64];

View File

@ -794,9 +794,9 @@ CHostModbusTcpBFProcess::~CHostModbusTcpBFProcess()
{
memset(name, '\0', sizeof(name));
}
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "waiting for child thread [%s] destroy.\n", (m_cpidName[0] != '\0') ? m_cpidName : "unknow");
pthread_join(m_cpid, NULL);
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (name[0] != '\0') ? name : "unknow");
vLog(LOG_DEBUG, "child protocol thread [%s] is destroyed.\n", (m_cpidName[0] != '\0') ? m_cpidName : "unknow");
}
}
@ -1175,13 +1175,13 @@ BOOLEAN CHostModbusTcpBFProcess::OnPreCreate(int id)
pthread_attr_setstacksize(&attr, MEMERY_1M);
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
if (pthread_create(&m_cpid, &attr, ryftp_process, this) < 0) {
if (pthread_create(&m_cpid, &attr, ryftp_process, this) < 0)
{
vLog(LOG_ERROR, "rymodbus create ryftp_process error(%d,%s).\n", errno, strerror(errno));
return TRUE;
}
char name[17];
snprintf(name, 16, "%s_ftp", m_pidName.c_str());
pthread_setname_np(m_cpid, name);
snprintf(m_cpidName, 16, "%s_ftp", m_pidName.c_str());
pthread_setname_np(m_cpid, m_cpidName);
pthread_attr_destroy(&attr);
}

View File

@ -65,6 +65,7 @@ private:
public:
std::string m_pidName;
BOOLEAN m_bHaveFTP; //存在FTP协议
char m_cpidName[16];
//ftp参数信息
char m_user[64];