fix(socket): 调整连接读超时与数据包解析逻辑

- 在 `OnOpen` 中为连接设置 3 秒读超时
- 简化 `handleTcp` 中不完整数据包的处理流程,移除手动唤醒逻辑
- 修改 `SocketCodec_Tomee.go` 中最大包体长度限制从 10MB 降至 10KB
- 修复 `Decode` 方法中未处理 `c.Next` 错误的问题
- 更新 .gitignore 忽略重复的 logic/logic1 文件路径
```
This commit is contained in:
2025-11-03 05:46:13 +08:00
parent f9279e75fa
commit 9a802ce948
4 changed files with 7 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ import (
var ErrIncompletePacket = errors.New("incomplete packet")
const maxBodyLen = 10 * 1024 * 1024 // 业务最大包体长度,按需调整
const maxBodyLen = 10 * 1024 // 业务最大包体长度,按需调整
// TomeeSocketCodec 协议格式:
//
// * 0 4
@@ -67,7 +67,7 @@ func (codec TomeeSocketCodec) Decode(c gnet.Conn) ([]byte, error) {
return nil, ErrIncompletePacket
}
// 提取包体
body, _ := c.Next(int(bodyLen))
body, err := c.Next(int(bodyLen))
return body, nil
return body, err
}