1
This commit is contained in:
parent
68454a74fe
commit
9a6fdb07e6
@ -13,6 +13,7 @@ type HallCluster struct {
|
||||
type HallClusterTable struct {
|
||||
f5.IdMetaTable[HallCluster]
|
||||
selfConf *HallCluster
|
||||
serverInfo string
|
||||
}
|
||||
|
||||
func (this *HallCluster) Init1() {
|
||||
@ -31,9 +32,14 @@ func (this *HallClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *HallClusterTable) GetServerInfo() string {
|
||||
return this.serverInfo
|
||||
}
|
||||
|
||||
func (this *HallClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("hallserver集群无法读取本服配置")
|
||||
}
|
||||
this.serverInfo = this.GetIp() + ":" + q5.ToString(this.GetListenPort())
|
||||
}
|
||||
|
@ -48,6 +48,14 @@ func (this *player) onOffline(){
|
||||
}
|
||||
}
|
||||
|
||||
func (this *player) reBind(socket f5.WspCliConn) {
|
||||
if this.socket.IsValid() {
|
||||
delete(_playerMgr.socketHash, this.socket)
|
||||
}
|
||||
this.socket = socket
|
||||
_playerMgr.socketHash[this.socket] = this
|
||||
}
|
||||
|
||||
func (this *player) GetName() string {
|
||||
return ""
|
||||
}
|
||||
|
@ -52,22 +52,26 @@ func (this *playerMgr) UnInit() {
|
||||
|
||||
func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
||||
{
|
||||
oldplayer := this.internalGetPlayerBySocket(hdr.GetSocket())
|
||||
if oldplayer != nil {
|
||||
oldHum := this.internalGetPlayerBySocket(hdr.GetSocket())
|
||||
if oldHum != nil {
|
||||
rspMsg := cs.SMLogin{}
|
||||
rspMsg.Errcode = proto.Int32(0)
|
||||
rspMsg.Errmsg = proto.String("")
|
||||
oldplayer.SendMsg(&rspMsg)
|
||||
rspMsg.ServerInfo = proto.String(mt.Table.HallCluster.GetServerInfo())
|
||||
oldHum.reBind(hdr.GetSocket())
|
||||
oldHum.SendMsg(&rspMsg)
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
oldplayer := this.internalGetPlayerByAccountId(msg.GetAccountId())
|
||||
if oldplayer != nil {
|
||||
oldHum := this.internalGetPlayerByAccountId(msg.GetAccountId())
|
||||
if oldHum != nil {
|
||||
rspMsg := cs.SMLogin{}
|
||||
rspMsg.Errcode = proto.Int32(0)
|
||||
rspMsg.Errmsg = proto.String("")
|
||||
oldplayer.SendMsg(&rspMsg)
|
||||
rspMsg.ServerInfo = proto.String(mt.Table.HallCluster.GetServerInfo())
|
||||
oldHum.reBind(hdr.GetSocket())
|
||||
oldHum.SendMsg(&rspMsg)
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -155,8 +159,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
|
||||
this.accountIdHash[hum.GetAccountId()] = hum
|
||||
this.socketHash[pendingReq.hdr.GetSocket()] = hum
|
||||
|
||||
rspMsg.ServerInfo = proto.String(
|
||||
mt.Table.HallCluster.GetIp() + ":" + q5.ToString(mt.Table.HallCluster.GetListenPort()))
|
||||
rspMsg.ServerInfo = proto.String(mt.Table.HallCluster.GetServerInfo())
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg)
|
||||
}
|
||||
|
||||
|
2
third_party/f5
vendored
2
third_party/f5
vendored
@ -1 +1 @@
|
||||
Subproject commit bda6cd38df8cf79a43ce3fe027b33936a26ec423
|
||||
Subproject commit 194793c17868a2ecc9ada927a8cfecf628152812
|
Loading…
x
Reference in New Issue
Block a user