优化服务器之间的底层连接方式

This commit is contained in:
flswld
2023-01-08 22:11:14 +08:00
parent 99408a745f
commit 6779ed8f20
21 changed files with 742 additions and 216 deletions

View File

@@ -106,11 +106,8 @@ func (k *KcpConnectManager) recvMsgHandle(protoMsg *ProtoMsg, session *Session)
logger.Error("conn not active so drop packet, cmdId: %v, userId: %v, convId: %v", protoMsg.CmdId, userId, protoMsg.ConvId)
return
}
// 转发到寻路服务器
if protoMsg.CmdId == cmd.QueryPathReq || protoMsg.CmdId == cmd.ObstacleModifyNotify {
if session.pathfindingServerAppId == "" {
return
}
// 转发到寻路服务器
if session.pathfindingServerAppId != "" && (protoMsg.CmdId == cmd.QueryPathReq || protoMsg.CmdId == cmd.ObstacleModifyNotify) {
gameMsg := new(mq.GameMsg)
gameMsg.UserId = userId
gameMsg.CmdId = protoMsg.CmdId
@@ -123,8 +120,8 @@ func (k *KcpConnectManager) recvMsgHandle(protoMsg *ProtoMsg, session *Session)
})
return
}
// 同时转发到战斗服务器
if protoMsg.CmdId == cmd.CombatInvocationsNotify && session.fightServerAppId != "" {
// 转发到战斗服务器
if session.fightServerAppId != "" && protoMsg.CmdId == cmd.CombatInvocationsNotify {
gameMsg := new(mq.GameMsg)
gameMsg.UserId = userId
gameMsg.CmdId = protoMsg.CmdId