合并杂项功能服务器节点到multi服务器节点

This commit is contained in:
flswld committed 2023-10-22 19:46:08 +08:00
1 parent 64699c23d7
commit 6cca998915
42 files changed
+344 -647

No files matched your search

+7 -10
View File
@@ -67,7 +67,7 @@ func NewMessageQueue(serverType string, appId string, discoveryClient *rpc.Disco
r.discoveryClient = discoveryClient
if serverType == api.GATE {
go r.runGateTcpMqServer()
} else if serverType == api.GS || serverType == api.ANTICHEAT || serverType == api.PATHFINDING || serverType == api.ROBOT {
} else if serverType == api.GS || serverType == api.MULTI || serverType == api.ROBOT {
go r.runGateTcpMqClient()
}
go r.natsMsgRecvHandler()
@@ -170,11 +170,10 @@ func (m *MessageQueue) parseNetMsg(rawData []byte) *NetMsg {
func (m *MessageQueue) sendHandler() {
// 网关tcp连接消息收发快速通道 key1:服务器类型 key2:服务器appid value:连接实例
gateTcpMqInstMap := map[string]map[string]*GateTcpMqInst{
api.GATE: make(map[string]*GateTcpMqInst),
api.GS: make(map[string]*GateTcpMqInst),
api.ANTICHEAT: make(map[string]*GateTcpMqInst),
api.PATHFINDING: make(map[string]*GateTcpMqInst),
api.ROBOT: make(map[string]*GateTcpMqInst),
api.GATE: make(map[string]*GateTcpMqInst),
api.GS: make(map[string]*GateTcpMqInst),
api.MULTI: make(map[string]*GateTcpMqInst),
api.ROBOT: make(map[string]*GateTcpMqInst),
}
for {
select {
@@ -320,10 +319,8 @@ func (m *MessageQueue) gateTcpMqHandshake(conn *net.TCPConn) {
inst.serverType = api.GATE
case api.GS:
inst.serverType = api.GS
case api.ANTICHEAT:
inst.serverType = api.ANTICHEAT
case api.PATHFINDING:
inst.serverType = api.PATHFINDING
case api.MULTI:
inst.serverType = api.MULTI
case api.ROBOT:
inst.serverType = api.ROBOT
default:
+10 -10
View File
@@ -63,16 +63,16 @@ const (
)
type ServerMsg struct {
AnticheatServerAppId string
UserId uint32
IsOnline bool
GameServerAppId string
JoinHostUserId uint32
PlayerMpInfo *PlayerMpInfo
ChatMsgInfo *ChatMsgInfo
AddFriendInfo *AddFriendInfo
ForwardDispatchInfo *ForwardDispatchInfo
AppVersion string
MultiServerAppId string
UserId uint32
IsOnline bool
GameServerAppId string
JoinHostUserId uint32
PlayerMpInfo *PlayerMpInfo
ChatMsgInfo *ChatMsgInfo
AddFriendInfo *AddFriendInfo
ForwardDispatchInfo *ForwardDispatchInfo
AppVersion string
}
type OriginInfo struct {
+3 -13
View File
@@ -35,19 +35,9 @@ func (m *MessageQueue) SendToGs(appId string, netMsg *NetMsg) {
m.netMsgInput <- netMsg
}
func (m *MessageQueue) SendToAnticheat(appId string, netMsg *NetMsg) {
netMsg.Topic = m.getTopic(api.ANTICHEAT, appId)
netMsg.ServerType = api.ANTICHEAT
netMsg.AppId = appId
originServerType, originServerAppId := m.getOriginServer()
netMsg.OriginServerType = originServerType
netMsg.OriginServerAppId = originServerAppId
m.netMsgInput <- netMsg
}
func (m *MessageQueue) SendToPathfinding(appId string, netMsg *NetMsg) {
netMsg.Topic = m.getTopic(api.PATHFINDING, appId)
netMsg.ServerType = api.PATHFINDING
func (m *MessageQueue) SendToMulti(appId string, netMsg *NetMsg) {
netMsg.Topic = m.getTopic(api.MULTI, appId)
netMsg.ServerType = api.MULTI
netMsg.AppId = appId
originServerType, originServerAppId := m.getOriginServer()
netMsg.OriginServerType = originServerType