From 1f9bdd62788fa145ee4166cb853e7ba17c652122 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 8 Sep 2023 13:40:22 +0800 Subject: [PATCH] 1 --- server/hallserver/app/app.go | 1 + server/hallserver/mt/HallCluster.go | 5 +++++ server/hallserver/player/playermgr.go | 6 ++++-- third_party/q5 | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/hallserver/app/app.go b/server/hallserver/app/app.go index 31c8105e..79c34f12 100644 --- a/server/hallserver/app/app.go +++ b/server/hallserver/app/app.go @@ -31,6 +31,7 @@ func (this *app) Init() { f5.LoadMetaTable(mt.Table) this.registerDataSources() this.initCb() + f5.GetSysLog().Info("local ip:%s", q5.GetLocalIP()) } func (this *app) UnInit() { diff --git a/server/hallserver/mt/HallCluster.go b/server/hallserver/mt/HallCluster.go index 78886d59..8e1e6018 100644 --- a/server/hallserver/mt/HallCluster.go +++ b/server/hallserver/mt/HallCluster.go @@ -1,6 +1,7 @@ package mt import ( + "q5" "f5" "mtb" ) @@ -18,6 +19,10 @@ func (this *HallCluster) Init1() { } +func (this *HallClusterTable) GetIp() string { + return q5.GetLocalIP() +} + func (this *HallClusterTable) GetListenPort() int32 { return this.selfConf.GetListenPort() } diff --git a/server/hallserver/player/playermgr.go b/server/hallserver/player/playermgr.go index fd6bafc6..2427eb49 100644 --- a/server/hallserver/player/playermgr.go +++ b/server/hallserver/player/playermgr.go @@ -111,6 +111,8 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli if pendingReq == nil || pendingReq.reqId != *reqId { return } + delete(this.pendingLoginHash, msg.GetAccountId()) + rspMsg := cs.SMLogin{} if rsp.GetErr() != nil { 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.addSocketHash(hdr.GetSocket(), &player) - serverInfo := "192.168.100.39:2000" + serverInfo := mt.Table.HallCluster.GetIp() + ":" + q5.ToString(mt.Table.HallCluster.GetListenPort()) rspMsg.ServerInfo = &serverInfo GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg) } @@ -164,7 +166,7 @@ func (this *playerMgr) reportServerState(masterIp string, masterPort int32) { params := map[string]string{ "node_id": q5.ToString(f5.GetApp().GetNodeId()), "instance_id": q5.ToString(f5.GetApp().GetInstanceId()), - "ip": "192.168.100.164", + "ip": mt.Table.HallCluster.GetIp(), "port": q5.ToString(mt.Table.HallCluster.GetListenPort()), "online_num": q5.ToString(0), "room_num": q5.ToString(0), diff --git a/third_party/q5 b/third_party/q5 index ed967899..f913e480 160000 --- a/third_party/q5 +++ b/third_party/q5 @@ -1 +1 @@ -Subproject commit ed967899c443330d8a83e121f28cf11768df6611 +Subproject commit f913e480a26e4adfce0f17adb5e7790648dd83a1