修复网关本地顶登录问题

This commit is contained in:
flswld
2023-04-03 19:53:39 +08:00
parent 5cbd8428a4
commit 4bc835e0b1
+18 -9
View File
@@ -398,15 +398,24 @@ func (k *KcpConnectManager) getPlayerToken(req *proto.GetPlayerTokenReq, session
return nil return nil
case <-regFinishNotifyChan: case <-regFinishNotifyChan:
} }
// 顶号 oldSession := k.GetSessionByUserId(uid)
connCtrlMsg := new(mq.ConnCtrlMsg) if oldSession != nil {
connCtrlMsg.KickUserId = uid // 本地顶号
connCtrlMsg.KickReason = kcp.EnetServerRelogin k.kcpEventInput <- &KcpEvent{
k.messageQueue.SendToAll(&mq.NetMsg{ ConvId: oldSession.conn.GetConv(),
MsgType: mq.MsgTypeConnCtrl, EventId: KcpConnRelogin,
EventId: mq.KickPlayerNotify, }
ConnCtrlMsg: connCtrlMsg, } else {
}) // 远程顶号
connCtrlMsg := new(mq.ConnCtrlMsg)
connCtrlMsg.KickUserId = uid
connCtrlMsg.KickReason = kcp.EnetServerRelogin
k.messageQueue.SendToAll(&mq.NetMsg{
MsgType: mq.MsgTypeConnCtrl,
EventId: mq.KickPlayerNotify,
ConnCtrlMsg: connCtrlMsg,
})
}
// 顶号等待 // 顶号等待
logger.Info("run global interrupt login kick wait, uid: %v", uid) logger.Info("run global interrupt login kick wait, uid: %v", uid)
timer = time.NewTimer(time.Second * 10) timer = time.NewTimer(time.Second * 10)