fix: listen socket CONNECT 不应触发 accepted 客户端逻辑

- WCHNET_HandleSockInt 第二路由条件增加 socketid!=g_json_socket_listen
- tcp_json_handle_sock_int 'Newly accepted' 检查增加 socketid!=g_json_socket_listen
- 防止 listen socket 的 CONNECT 事件误触发 WCHNET_ModifyRecvBuf 和 g_json_socket_client 覆写

根因:TCP_LISTEN socket 和 accepted client 是不同 socket ID(1 vs 3),
listen socket 的 CONNECT 不应穿透到 'newly accepted' 分支去配置 recv buffer,
否则会干扰 WCHNET 对 accepted socket 的数据路由
This commit is contained in:
wangfq
2026-07-01 09:52:28 +08:00
parent be8c48688c
commit 7804d97a45
2 changed files with 6 additions and 3 deletions

View File

@@ -481,13 +481,15 @@ void WCHNET_HandleSockInt(uint8_t socketid, uint8_t intstat)
{
uint8_t i;
// Route JSON protocol socket events
// Route JSON protocol socket events (listen socket, client socket)
if (socketid == g_json_socket_listen || socketid == g_json_socket_client) {
tcp_json_handle_sock_int(socketid, intstat);
return;
}
// Also catch newly accepted TCP connections that might be JSON clients
if ((intstat & SINT_STAT_CONNECT) && socketid != SocketId_TCP && socketid != SocketId_UDP) {
// Exclude: listen socket, SSC TCP, UDP
if ((intstat & SINT_STAT_CONNECT) && socketid != g_json_socket_listen
&& socketid != SocketId_TCP && socketid != SocketId_UDP) {
tcp_json_handle_sock_int(socketid, intstat);
return;
}