fix(socket): 修复连接处理逻辑并优化数据解码流程

- 修复 `OnOpen` 中网络类型判断位置不正确的问题,提前过滤非 TCP 连接
- 移除 `OnTraffic` 中重复的网络类型判断
- 优化 `TomeeSocketCodec` 的解码逻辑,使用 `InboundBuffered` 和 `Next` 提高效率
- 调整 `ByteArray` 创建方法参数,避免可变参数带来的性能损耗
- 在 `ClientData` 中将 `IsCrossDomain` 改为 `sync.Once` 避免重复处理
- 使用 `AsyncWrite` 替代 `Write` 提升写入异步性
- 修复连接关闭流程,使用
This commit is contained in:
2025-11-01 14:31:19 +08:00
parent 008701d3de
commit ea4ca98e49
11 changed files with 60 additions and 92 deletions

View File

@@ -117,7 +117,6 @@ func (i *Input) Parseskill(defender *Input, skill *action.SelectSkillAction) {
//这里是给双方添加buff
if t != nil {
t.SetArgs(i, temparg[:args]...) //设置入参,施加方永远是我方
t.ID(v)
if t.GetOwner() { //如果取反,说明是给对方添加的回合效果
//实际上,owner永远为反,说明是对方给我添加的