From 1ce2e783ae59dd8e0373093d78a2d013fb12b87b Mon Sep 17 00:00:00 2001 From: wangfq Date: Fri, 3 Jul 2026 13:49:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Auth=20timeout=20=E6=AD=BB=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E6=89=93=E5=8D=B0=20=E2=80=94=20=E6=94=B9=E7=94=A8=20?= =?UTF-8?q?do=5Frestart=20=E8=80=8C=E9=9D=9E=E6=89=8B=E5=B7=A5=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: WCHNET_SocketClose 后 g_json_socket_listen 未归 0xFF, g_json_auth_timer 未重置, 下次 poll 条件仍满足 → 无限打印. 修复: auth timeout 直接 goto do_restart, 走完整的 close→recreate 流程 --- vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c index f7b64b5..87160f5 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c @@ -1210,14 +1210,11 @@ void tcp_json_poll(void) { goto do_restart; } - // Auth timeout check (existing) + // Auth timeout — 60s 未完成鉴权 → 重启网络接口 if (g_json_auth_state == JSON_STATE_WAIT_AUTH) { if (mstick() - g_json_auth_timer > TCP_JSON_AUTH_TIMEOUT_MS) { - PRINT("JSON: Auth timeout, closing connection\n"); - WCHNET_SocketClose(g_json_socket_listen, TCP_CLOSE_NORMAL); - g_json_auth_state = JSON_STATE_WAIT_AUTH; - g_json_pwd_retry = 0; - g_json_recv_len = 0; + PRINT("JSON: Auth timeout → restart\n"); + goto do_restart; } }