From: 胡传军 <1224667075@qq.com> Date: Wed, 13 Aug 2025 23:49:25 +0000 (+0000) Subject: Merge #2073 into sdk602patch0911 from refs/changes/2073/head X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a129d32b5ae9c26e962355b555300ea8fabd5c48;p=mirrors%2FFD230.git Merge #2073 into sdk602patch0911 from refs/changes/2073/head 增加循环判断条件,避免断连后一直无法正确退出循环 * refs/changes/2073/head: (1 commits squashed) - 增加循环判断条件,避免断连后一直无法正确退出循环 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/2073 --- diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp index 4ba5118cc..ea8cb7c6a 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp @@ -1088,6 +1088,13 @@ void bk_websocket_demo(void *data) { // 检查超时 if ((uint32_t)osKernelGetTickCount() - last_activity > AI_RECEIVE_TIMEOUT_MS) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Receive timeout, reconnecting..."); + + tcp_connection_state_t current_state = tcp_get_connection_state(chat_client->tcp_handle); + if(current_state!=TCP_STATE_CONNECTED) + { + break; + } + if(disconnect_server == 0) { last_activity = (uint32_t)osKernelGetTickCount(); @@ -1633,7 +1640,12 @@ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "等待ASR WebSocket握手完成... (%d m if ((uint32_t)osKernelGetTickCount() - last_activity > AI_RECEIVE_TIMEOUT_MS) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ASR receive timeout, reconnecting..."); - if(disconnect_server == 0 ) + tcp_connection_state_t current_state = tcp_get_connection_state(asr_client->tcp_handle); + if(current_state!=TCP_STATE_CONNECTED) + { + break; + } + if(disconnect_server == 0) { last_activity = (uint32_t)osKernelGetTickCount(); continue; @@ -2089,6 +2101,11 @@ void bk_websocket_tts(void *data) { if(disconnect_server == 0) { + tcp_connection_state_t current_state = tcp_get_connection_state(tts_client->tcp_handle); + if(current_state!=TCP_STATE_CONNECTED) + { + break; + } last_activity = (uint32_t)osKernelGetTickCount(); continue; }