添加错误映射文件的处理防止崩溃,优化mq处理topic前缀,添加空指针预防
This commit is contained in:
@@ -132,10 +132,25 @@ void CloseIECReports(chnl_usr_t *chnl_usr)
|
||||
ied_usr = GET_IEDEXT_ADDR(ied);
|
||||
for(cpuno=0 ; cpuno<ied->cpucount; cpuno++) {
|
||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||
|
||||
//添加保护lnk20260602
|
||||
if (LD_info->cpuno == 0 ||
|
||||
LD_info->LD_name == NULL ||
|
||||
LD_info->rptcount <= 0 ||
|
||||
LD_info->rptinfo == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for(rpt_no=0 ; rpt_no<LD_info->rptcount; rpt_no++) {
|
||||
char rpt_inst_name[65];
|
||||
rptinfo = LD_info->rptinfo[rpt_no];
|
||||
if ( ! rptinfo->rpt_registered )
|
||||
|
||||
//添加保护lnk20260602
|
||||
if (rptinfo == NULL)
|
||||
continue;
|
||||
|
||||
if ( !rptinfo->rpt_registered )
|
||||
continue;
|
||||
if ( rptinfo->chnl_id != chnl_usr->chnl_id)
|
||||
continue;
|
||||
@@ -260,6 +275,18 @@ void IECReport_tryGI(chnl_usr_t *chnl_usr,rptinfo_t *rptinfo)
|
||||
//增加处理根据稳态,或暂态功能等,决定 报告是否需要注册、取消注册或 不做任何处理
|
||||
int judge_rpt_next_should_do(rptinfo_t *rptinfo)
|
||||
{
|
||||
|
||||
if (rptinfo == NULL) {
|
||||
printf("[RPT][ERROR] rptinfo is NULL\n");
|
||||
return SHOULD_DO_NOTHING;
|
||||
}
|
||||
|
||||
if (rptinfo->LD_info == NULL) {
|
||||
printf("[RPT][ERROR] rptinfo->LD_info is NULL, rptID=%s\n",
|
||||
rptinfo->rptID ? rptinfo->rptID : "NULL");
|
||||
return SHOULD_DO_NOTHING;
|
||||
}
|
||||
|
||||
int should_register_state = 1; //各功能默认注册
|
||||
int is_real_report = (rptinfo->report_PQ_type & REPORT_TYPE_REAL);//报告控制中包含的类型
|
||||
int is_soe_report = (rptinfo->report_PQ_type & REPORT_TYPE_SOE);
|
||||
@@ -302,7 +329,23 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
||||
{
|
||||
LD_info = &(ied_usr->LD_info[cpuno]); //遍历监测点
|
||||
|
||||
if (LD_info->cpuno==0){
|
||||
//添加保护,防止台账中测点号不连续导致的崩溃
|
||||
if (LD_info->cpuno == 0 ||
|
||||
LD_info->LD_name == NULL ||
|
||||
LD_info->rptcount <= 0 ||
|
||||
LD_info->rptinfo == NULL)
|
||||
{
|
||||
printf("[RPT][SKIP] invalid LD_info cpu=%d cpuno=%d LD_name=%p rptcount=%d rptinfo=%p\n",
|
||||
cpuno,
|
||||
LD_info->cpuno,
|
||||
LD_info->LD_name,
|
||||
LD_info->rptcount,
|
||||
LD_info->rptinfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
//未初始化的测点告警没有意义,直接访问id还可能崩溃
|
||||
/*if (LD_info->cpuno==0){
|
||||
// 仅在还没达到5次上限时打印
|
||||
if (!LD_info->has_logged_regist) {
|
||||
LD_info->registcount++;
|
||||
@@ -319,13 +362,39 @@ void ChannelCheckIECReports(chnl_usr_t *chnl_usr)
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
for(rpt_no=0 ; rpt_no<LD_info->rptcount; rpt_no++) { //遍历报告(映射文件中读取的报告控制)
|
||||
|
||||
rptinfo = LD_info->rptinfo[rpt_no] ;
|
||||
|
||||
//检查是否需要注册或取消注册报告,或不做任何处理
|
||||
printf("[RPT][CHECK] ip=%s cpu=%d rpt_no=%d rptcount=%d LD_name=%s rptinfo=%p\n",
|
||||
chnl_usr->ip_str,
|
||||
cpuno,
|
||||
rpt_no,
|
||||
LD_info->rptcount,
|
||||
LD_info->LD_name ? LD_info->LD_name : "NULL",
|
||||
rptinfo);
|
||||
|
||||
if (rptinfo == NULL) {
|
||||
printf("[RPT][ERROR] rptinfo NULL, skip\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rptinfo->LD_info == NULL) {
|
||||
printf("[RPT][ERROR] rptinfo->LD_info NULL, rptID=%s, skip\n",
|
||||
rptinfo->rptID ? rptinfo->rptID : "NULL");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rptinfo->rptID == NULL || rptinfo->rptID[0] == '\0') {
|
||||
printf("[RPT][ERROR] rptID empty, skip\n");
|
||||
continue;
|
||||
}
|
||||
//添加保护
|
||||
|
||||
if (judge_rpt_next_should_do(rptinfo)==SHOULD_DO_NOTHING)//检查是否触发
|
||||
{
|
||||
//DIY_DEBUGLOG_CODE(LD_info->mp_id,2,LOG_CODE_REPORT,"【DEBUG】监测点:%s - id:%s不注册报告", LD_info->name,LD_info->mp_id);
|
||||
@@ -496,8 +565,17 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
||||
for(cpuno=0 ; cpuno<ied->cpucount; cpuno++) {
|
||||
LD_info = &(ied_usr->LD_info[cpuno]);
|
||||
|
||||
//添加保护,防止台账中测点号不连续导致的崩溃
|
||||
if (LD_info->cpuno == 0 ||
|
||||
LD_info->LD_name == NULL ||
|
||||
LD_info->logcount <= 0 ||
|
||||
LD_info->loginfo == NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//日志控制块缺失
|
||||
if (LD_info->logcount<=0){
|
||||
/*if (LD_info->logcount<=0){
|
||||
// 仅在还没达到5次上限时打印
|
||||
if (!LD_info->has_logged_regist) {
|
||||
LD_info->registcount++;
|
||||
@@ -515,10 +593,14 @@ void ChannelCheckIECLogs(chnl_usr_t *chnl_usr)
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
loginfo = LD_info->loginfo[0] ;
|
||||
|
||||
//添加保护,防止台账中测点号不连续导致的崩溃
|
||||
if (loginfo == NULL || loginfo->LD_info == NULL)
|
||||
continue;
|
||||
|
||||
apr_sleep(apr_time_from_sec(1) / 10);
|
||||
|
||||
Check_Recall_Config(LD_info->mp_id);//尝试获取xml结构
|
||||
|
||||
Reference in New Issue
Block a user