fix: Auth timeout 死循环打印 — 改用 do_restart 而非手工 close
根因: WCHNET_SocketClose 后 g_json_socket_listen 未归 0xFF,
g_json_auth_timer 未重置, 下次 poll 条件仍满足 → 无限打印.
修复: auth timeout 直接 goto do_restart, 走完整的 close→recreate 流程
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user