This commit is contained in:
aozhiwei 2023-09-08 13:52:42 +08:00
parent e3307f7e64
commit 3a216a6795
2 changed files with 12 additions and 9 deletions

View File

@ -27,3 +27,10 @@ func (this *player) SendMsg(rspMsg proto.Message) {
func (this *player) GetRoom() *common.Room {
return this.room
}
func (this *player) init(req *pendingLoginRequest){
this.socket = req.hdr.GetSocket()
this.accountId = req.msg.GetAccountId()
this.sessionId = req.msg.GetSessionId()
}

View File

@ -148,14 +148,10 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
return
}
player := player{
socket: hdr.GetSocket(),
accountId: msg.GetAccountId(),
sessionId: msg.GetAccountId(),
}
// Add to online user
this.addplayer(&player)
this.addSocketHash(hdr.GetSocket(), &player)
hum := new(player)
hum.init(pendingReq)
this.addPlayer(hum)
this.addSocketHash(hdr.GetSocket(), hum)
serverInfo := mt.Table.HallCluster.GetIp() + ":" + q5.ToString(mt.Table.HallCluster.GetListenPort())
rspMsg.ServerInfo = &serverInfo
@ -186,7 +182,7 @@ func (this *playerMgr) GetPlayers() map[string]*player {
return this.accountIdHash
}
func (this *playerMgr) addplayer(p *player) {
func (this *playerMgr) addPlayer(p *player) {
this.accountIdHash[p.accountId] = p
}