From c1051ce5bcb35daa3e7b2e72828e1d296239bd62 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Wed, 13 Aug 2025 23:33:16 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AA=E7=8E=AF=E5=88=A4?= =?utf8?q?=E6=96=AD=E6=9D=A1=E4=BB=B6=EF=BC=8C=E9=81=BF=E5=85=8D=E6=96=AD?= =?utf8?q?=E8=BF=9E=E5=90=8E=E4=B8=80=E7=9B=B4=E6=97=A0=E6=B3=95=E6=AD=A3?= =?utf8?q?=E7=A1=AE=E9=80=80=E5=87=BA=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../slip/cat1Service/cat1_ai_server.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 4ff62376d..312556ec0 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp @@ -1060,6 +1060,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(); @@ -1593,7 +1600,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; @@ -2044,6 +2056,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; } -- 2.17.1