更新 tcpRecMQ 和接收线程 退出逻辑

This commit is contained in:
CSSC-WORK\murmur 2023-06-21 11:08:53 +08:00
parent c83440e33a
commit 2c8ddb1cef
3 changed files with 7 additions and 6 deletions

View File

@ -69,4 +69,4 @@ void sys_log_file_backend_init(void)
ulog_file_backend_enable(file_be); //必须使能才能有效
}
MSH_CMD_EXPORT(sys_log_file_backend_init,log2file);
//INIT_APP_EXPORT(sys_log_file_backend_init);
INIT_APP_EXPORT(sys_log_file_backend_init);

View File

@ -179,9 +179,10 @@ void tcpRecMQ_thread_entry(void)
}
else
{
LOG_E("received error.");
msg.size=0;//收到数据长度为0表示tcp断开
rt_mq_send(&TTrx_mq, &msg, sizeof(msg));
LOG_E("tcp error, close.");
break;
// return -RT_ERROR;
}
}
}

View File

@ -540,6 +540,9 @@ void recTT_thread_entry()
if (rt_mq_recv(&TTrx_mq, &msg, sizeof(msg), RT_WAITING_FOREVER) == RT_EOK)
{
// LOG_D("%d Bytes received...",msg.size);
if (!msg.size) {//收到数据长度为0表示tcp断开
break;
}
LOG_HEX("tcpTT", 16, msg.data, msg.size);
//此处处理接收到数据
rt_uint8_t rec_good[] = { 0x88, 0xAA, 0xBB, 0x88 };//前四字节
@ -548,9 +551,6 @@ void recTT_thread_entry()
LOG_I("ack is good.");
}
}
if (!isTCPok()) {//TCP断开
break;
}
}
}
//INIT_COMPONENT_EXPORT(recTT_thread_entry);