From 1607952f54c7faea4ce1f1bc62c66a244bc16e2b Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Wed, 13 Aug 2025 10:57:56 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E6=8F=A1=E6=89=8B=E6=8E=A7?= =?utf8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../slip/cat1Service/cat1_ai_server.cpp | 60 ++----------------- 1 file changed, 6 insertions(+), 54 deletions(-) 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 c50cab45c..3ceb23b07 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp @@ -874,26 +874,10 @@ void bk_websocket_demo(void *data) { goto cleanup_and_exit; } - // 等待WebSocket握手完成,增加超时机制 - uint32_t handshake_start_time = (uint32_t)osKernelGetTickCount(); - const uint32_t handshake_timeout_ms = 30000; // 30秒超时 - - while (chat_client->handshake == 0) { - // 检查是否超时 - if ((uint32_t)osKernelGetTickCount() - handshake_start_time > handshake_timeout_ms) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WebSocket握手超时 (%d ms),重新连接", handshake_timeout_ms); - lwip_close_websocket_client(chat_client); - chat_client = NULL; - goto char_reconnet; - } - + while (chat_client->handshake==0 ) + { msleep(1000); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "等待WebSocket握手完成... (%d ms)", - (uint32_t)osKernelGetTickCount() - handshake_start_time); } - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "WebSocket握手完成,耗时 %d ms", - (uint32_t)osKernelGetTickCount() - handshake_start_time); // 设置socket超时 // struct timeval timeout; @@ -1361,26 +1345,10 @@ void bk_websocket_asr(void *data) { goto asr_cleanup_and_exit; } - // 等待ASR WebSocket握手完成,增加超时机制 - uint32_t asr_handshake_start_time = (uint32_t)osKernelGetTickCount(); - const uint32_t asr_handshake_timeout_ms = 30000; // 30秒超时 - - while (asr_client->handshake == 0) { - // 检查是否超时 - if ((uint32_t)osKernelGetTickCount() - asr_handshake_start_time > asr_handshake_timeout_ms) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ASR WebSocket握手超时 (%d ms),重新连接", asr_handshake_timeout_ms); - lwip_close_websocket_client(asr_client); - asr_client = NULL; - goto asr_cleanup_and_exit; - } - + while (asr_client->handshake==0) + { msleep(1000); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "等待ASR WebSocket握手完成... (%d ms)", - (uint32_t)osKernelGetTickCount() - asr_handshake_start_time); } - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ASR WebSocket握手完成,耗时 %d ms", - (uint32_t)osKernelGetTickCount() - asr_handshake_start_time); uapi_cat1_keep_wakeup(1); @@ -1796,26 +1764,10 @@ void bk_websocket_tts(void *data) { goto tts_cleanup_and_exit; } - // 等待TTS WebSocket握手完成,增加超时机制 - uint32_t tts_handshake_start_time = (uint32_t)osKernelGetTickCount(); - const uint32_t tts_handshake_timeout_ms = 30000; // 30秒超时 - - while (tts_client->handshake == 0) { - // 检查是否超时 - if ((uint32_t)osKernelGetTickCount() - tts_handshake_start_time > tts_handshake_timeout_ms) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TTS WebSocket握手超时 (%d ms),重新连接", tts_handshake_timeout_ms); - lwip_close_websocket_client(tts_client); - tts_client = NULL; - goto tts_cleanup_and_exit; - } - + while (tts_client->handshake==0) + { msleep(1000); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "等待TTS WebSocket握手完成... (%d ms)", - (uint32_t)osKernelGetTickCount() - tts_handshake_start_time); } - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "TTS WebSocket握手完成,耗时 %d ms", - (uint32_t)osKernelGetTickCount() - tts_handshake_start_time); server_state = 0x04 ^ server_state; -- 2.17.1