diff --git a/server/imserver/MSConn.cc b/server/imserver/MSConn.cc index de14da9..4234d79 100644 --- a/server/imserver/MSConn.cc +++ b/server/imserver/MSConn.cc @@ -10,7 +10,10 @@ #include #include #include + #include "app.h" +#include "playermgr.h" +#include "jsondatamgr.h" const int PACK_MAX = 1024 * 64 * 2; @@ -41,6 +44,7 @@ void MSConn::Init(int instance_id, const std::string& remote_ip, int remote_port MSConn* conn = (MSConn*)param.sender.GetUserData(); conn->CheckAlive(); conn->SyncIMServerList(); + conn->ReportServerInfo(); }); } @@ -183,3 +187,16 @@ void MSConn::SyncIMServerList() SendMsg(msg); } } + +void MSConn::ReportServerInfo() +{ + if (Connected()) { + ss::SS_IM_ReportServerInfo msg; + msg.set_instance_id(App::Instance()->instance_id); + msg.set_online_num(PlayerMgr::Instance()->OnlineNum()); + msg.set_ip(JsonDataMgr::Instance()->GetConf()->At("ip")->AsXValue().GetString()); + msg.set_port(JsonDataMgr::Instance()->GetConf()->At("wsproxy_port")->AsXValue().GetInt()); + msg.set_servicing(App::Instance()->servicing); + SendMsg(msg); + } +} diff --git a/server/imserver/MSConn.h b/server/imserver/MSConn.h index b5df570..6164676 100644 --- a/server/imserver/MSConn.h +++ b/server/imserver/MSConn.h @@ -43,6 +43,7 @@ class MSConn void CheckAlive(); void SyncIMServerList(); + void ReportServerInfo(); private: char *recv_buff_ = nullptr; diff --git a/server/imserver/app.h b/server/imserver/app.h index 5f84162..8b56fc6 100644 --- a/server/imserver/app.h +++ b/server/imserver/app.h @@ -66,6 +66,7 @@ private: public: int instance_id = 0; int nowtime = 0; + bool servicing = true; private: std::mutex *loop_mutex_ = nullptr; diff --git a/server/imserver/playermgr.h b/server/imserver/playermgr.h index 0452d2f..3373fe5 100644 --- a/server/imserver/playermgr.h +++ b/server/imserver/playermgr.h @@ -43,9 +43,9 @@ class PlayerMgr : public a8::Singleton void OnWSProxyDisconnect(a8::XParams& param); void WatchPlayer(Friend& friend_data); void UnWatchPlayer(Friend& friend_data); + int OnlineNum(); private: - int OnlineNum(); void OnClientDisconnect(a8::XParams& param); void RemovePlayerBySocket(int socket_handle); f8::MsgHdr* GetHdrBySocket(int socket_handle); diff --git a/server/masterserver/GGListener.h b/server/masterserver/GGListener.h index aff1698..a716c64 100644 --- a/server/masterserver/GGListener.h +++ b/server/masterserver/GGListener.h @@ -1,5 +1,7 @@ #pragma once +#include "framework/cpp/netmsghandler.h" + //game client listener namespace a8 { @@ -29,6 +31,9 @@ class GGListener : public a8::Singleton { static int msgid = f8::Net_GetMessageId(msg); f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg); + #ifdef DEBUG + f8::DumpMsgToLog(msg, "<<<<<< { static int msgid = f8::Net_GetMessageId(msg); f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg); + #ifdef DEBUG + f8::DumpMsgToLog(msg, "<<<<<<>>>>>WSP "); + #endif } } @@ -351,7 +354,18 @@ void App::ProcessIMServerMsg(f8::MsgHdr& hdr) case HID_IMSMgr: ProcessNetMsg(handler, IMSMgr::Instance(), hdr); break; + case HID_SvrMgr: + ProcessNetMsg(handler, SvrMgr::Instance(), hdr); + break; + case HID_CacheMgr: + ProcessNetMsg(handler, CacheMgr::Instance(), hdr); + break; + default: + break; } + #ifdef DEBUG + f8::DumpMsgToLog(hdr, handler, ">>>>>>IMS "); + #endif } } diff --git a/server/masterserver/precompile.h b/server/masterserver/precompile.h index 50e6f1d..29d7ab0 100644 --- a/server/masterserver/precompile.h +++ b/server/masterserver/precompile.h @@ -16,5 +16,5 @@ namespace google } #include "framework/cpp/types.h" +#include "framework/cpp/utils.h" #include "framework/cpp/protoutils.h" - diff --git a/third_party/framework b/third_party/framework index 6d4d042..a24a743 160000 --- a/third_party/framework +++ b/third_party/framework @@ -1 +1 @@ -Subproject commit 6d4d04235b27818b29d0f83206052de90ac8afd8 +Subproject commit a24a743b051656e599f0939a49fed3847ed17206