This commit is contained in:
aozhiwei 2023-09-08 13:40:22 +08:00
parent 50df272959
commit 1f9bdd6278
4 changed files with 11 additions and 3 deletions

View File

@ -31,6 +31,7 @@ func (this *app) Init() {
f5.LoadMetaTable(mt.Table) f5.LoadMetaTable(mt.Table)
this.registerDataSources() this.registerDataSources()
this.initCb() this.initCb()
f5.GetSysLog().Info("local ip:%s", q5.GetLocalIP())
} }
func (this *app) UnInit() { func (this *app) UnInit() {

View File

@ -1,6 +1,7 @@
package mt package mt
import ( import (
"q5"
"f5" "f5"
"mtb" "mtb"
) )
@ -18,6 +19,10 @@ func (this *HallCluster) Init1() {
} }
func (this *HallClusterTable) GetIp() string {
return q5.GetLocalIP()
}
func (this *HallClusterTable) GetListenPort() int32 { func (this *HallClusterTable) GetListenPort() int32 {
return this.selfConf.GetListenPort() return this.selfConf.GetListenPort()
} }

View File

@ -111,6 +111,8 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
if pendingReq == nil || pendingReq.reqId != *reqId { if pendingReq == nil || pendingReq.reqId != *reqId {
return return
} }
delete(this.pendingLoginHash, msg.GetAccountId())
rspMsg := cs.SMLogin{} rspMsg := cs.SMLogin{}
if rsp.GetErr() != nil { if rsp.GetErr() != nil {
rspMsg.Errcode = proto.Int32(2) rspMsg.Errcode = proto.Int32(2)
@ -155,7 +157,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
this.addplayer(&player) this.addplayer(&player)
this.addSocketHash(hdr.GetSocket(), &player) this.addSocketHash(hdr.GetSocket(), &player)
serverInfo := "192.168.100.39:2000" serverInfo := mt.Table.HallCluster.GetIp() + ":" + q5.ToString(mt.Table.HallCluster.GetListenPort())
rspMsg.ServerInfo = &serverInfo rspMsg.ServerInfo = &serverInfo
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg) GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg)
} }
@ -164,7 +166,7 @@ func (this *playerMgr) reportServerState(masterIp string, masterPort int32) {
params := map[string]string{ params := map[string]string{
"node_id": q5.ToString(f5.GetApp().GetNodeId()), "node_id": q5.ToString(f5.GetApp().GetNodeId()),
"instance_id": q5.ToString(f5.GetApp().GetInstanceId()), "instance_id": q5.ToString(f5.GetApp().GetInstanceId()),
"ip": "192.168.100.164", "ip": mt.Table.HallCluster.GetIp(),
"port": q5.ToString(mt.Table.HallCluster.GetListenPort()), "port": q5.ToString(mt.Table.HallCluster.GetListenPort()),
"online_num": q5.ToString(0), "online_num": q5.ToString(0),
"room_num": q5.ToString(0), "room_num": q5.ToString(0),

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit ed967899c443330d8a83e121f28cf11768df6611 Subproject commit f913e480a26e4adfce0f17adb5e7790648dd83a1