This commit is contained in:
azw 2023-04-09 07:27:47 +00:00
parent 57123819a0
commit 4541b002b2
4 changed files with 22 additions and 22 deletions

View File

@ -111,7 +111,7 @@ bool App::Init(int argc, char* argv[])
f8::Timer::Instance()->Init(); f8::Timer::Instance()->Init();
JsonDataMgr::Instance()->Init(); JsonDataMgr::Instance()->Init();
uuid.SetMachineId((node_id - 1) * MAX_NODE_ID + instance_id); uuid.SetMachineId((node_id - 1) * MAX_NODE_ID + instance_id);
GameClientMgr::Instance()->Init(); DownStreamMgr::Instance()->Init();
MasterSvrMgr::Instance()->Init(); MasterSvrMgr::Instance()->Init();
TargetConnMgr::Instance()->Init(); TargetConnMgr::Instance()->Init();
GCListener::Instance()->Init(); GCListener::Instance()->Init();
@ -170,7 +170,7 @@ void App::UnInit()
GCListener::Instance()->UnInit(); GCListener::Instance()->UnInit();
MasterSvrMgr::Instance()->UnInit(); MasterSvrMgr::Instance()->UnInit();
TargetConnMgr::Instance()->UnInit(); TargetConnMgr::Instance()->UnInit();
GameClientMgr::Instance()->UnInit(); DownStreamMgr::Instance()->UnInit();
JsonDataMgr::Instance()->UnInit(); JsonDataMgr::Instance()->UnInit();
f8::Timer::Instance()->UnInit(); f8::Timer::Instance()->UnInit();
HandlerMgr::Instance()->UnInit(); HandlerMgr::Instance()->UnInit();
@ -347,7 +347,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
return; return;
} }
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) { if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) {
DownStream* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle); DownStream* client = DownStreamMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
if (!client) { if (!client) {
switch (hdr.msgid) { switch (hdr.msgid) {
case ss::_SS_CMLogin: case ss::_SS_CMLogin:
@ -388,7 +388,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
} }
} }
} else { } else {
DownStream* client = GameClientMgr::Instance()->GetGameClientBySocket(hdr.socket_handle); DownStream* client = DownStreamMgr::Instance()->GetGameClientBySocket(hdr.socket_handle);
if (client && client->conn) { if (client && client->conn) {
if (client->conn) { if (client->conn) {
client->conn->ForwardClientMsg(hdr); client->conn->ForwardClientMsg(hdr);
@ -420,7 +420,7 @@ void App::ProcessTargetServerMsg(f8::MsgHdr& hdr)
return; return;
} }
if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) { if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect) {
GameClientMgr::Instance()->BindTargetConn(hdr.socket_handle, hdr.ip_saddr); DownStreamMgr::Instance()->BindTargetConn(hdr.socket_handle, hdr.ip_saddr);
GCListener::Instance()->MarkClient(hdr.socket_handle, true); GCListener::Instance()->MarkClient(hdr.socket_handle, true);
} }
GCListener::Instance()->ForwardTargetConnMsg(hdr); GCListener::Instance()->ForwardTargetConnMsg(hdr);
@ -441,13 +441,13 @@ void App::ProcessIMMsg()
switch (im_work_node_->msgid) { switch (im_work_node_->msgid) {
case IM_ClientSocketDisconnect: case IM_ClientSocketDisconnect:
{ {
GameClientMgr::Instance()->OnClientDisconnect(pdelnode->params); DownStreamMgr::Instance()->OnClientDisconnect(pdelnode->params);
MasterSvrMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender, true); MasterSvrMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender, true);
} }
break; break;
case IM_TargetConnConnect: case IM_TargetConnConnect:
{ {
GameClientMgr::Instance()->OnTargetServerConnect(pdelnode->params); DownStreamMgr::Instance()->OnTargetServerConnect(pdelnode->params);
TargetConn* conn = TargetConnMgr::Instance()->GetConnById(pdelnode->params.sender); TargetConn* conn = TargetConnMgr::Instance()->GetConnById(pdelnode->params.sender);
if (conn && conn->Connected()) { if (conn && conn->Connected()) {
conn->SendStockMsg(); conn->SendStockMsg();
@ -456,7 +456,7 @@ void App::ProcessIMMsg()
break; break;
case IM_TargetConnDisconnect: case IM_TargetConnDisconnect:
{ {
GameClientMgr::Instance()->OnTargetServerDisconnect(pdelnode->params); DownStreamMgr::Instance()->OnTargetServerDisconnect(pdelnode->params);
} }
break; break;
case IM_ExecGM: case IM_ExecGM:

View File

@ -11,11 +11,11 @@
#include "GCListener.h" #include "GCListener.h"
#include "app.h" #include "app.h"
void GameClientMgr::Init() void DownStreamMgr::Init()
{ {
} }
void GameClientMgr::UnInit() void DownStreamMgr::UnInit()
{ {
for (auto& pair : socket_hash_) { for (auto& pair : socket_hash_) {
delete pair.second; delete pair.second;
@ -27,7 +27,7 @@ void GameClientMgr::UnInit()
} }
#if 0 #if 0
void GameClientMgr::OnClientDisconnect(a8::XParams& param) void DownStreamMgr::OnClientDisconnect(a8::XParams& param)
{ {
GameClient* client = GetGameClientBySocket(param.sender); GameClient* client = GetGameClientBySocket(param.sender);
if (client) { if (client) {
@ -43,7 +43,7 @@ void GameClientMgr::OnClientDisconnect(a8::XParams& param)
#endif #endif
#if 0 #if 0
void GameClientMgr::OnTargetServerDisconnect(a8::XParams& param) void DownStreamMgr::OnTargetServerDisconnect(a8::XParams& param)
{ {
std::list<GameClient*> delete_client; std::list<GameClient*> delete_client;
for (auto& pair : socket_hash_) { for (auto& pair : socket_hash_) {
@ -61,19 +61,19 @@ void GameClientMgr::OnTargetServerDisconnect(a8::XParams& param)
#endif #endif
#if 0 #if 0
void GameClientMgr::OnTargetServerConnect(a8::XParams& param) void DownStreamMgr::OnTargetServerConnect(a8::XParams& param)
{ {
} }
#endif #endif
DownStream* GameClientMgr::GetGameClientBySocket(int sockhandle) DownStream* DownStreamMgr::GetGameClientBySocket(int sockhandle)
{ {
auto itr = socket_hash_.find(sockhandle); auto itr = socket_hash_.find(sockhandle);
return itr != socket_hash_.end() ? itr->second : nullptr; return itr != socket_hash_.end() ? itr->second : nullptr;
} }
void GameClientMgr::BindTargetConn(int socket_handle, int conn_instance_id) void DownStreamMgr::BindTargetConn(int socket_handle, int conn_instance_id)
{ {
TargetConn* conn = TargetConnMgr::Instance()->GetConnById(conn_instance_id); TargetConn* conn = TargetConnMgr::Instance()->GetConnById(conn_instance_id);
if (conn) { if (conn) {
@ -112,7 +112,7 @@ void GameClientMgr::BindTargetConn(int socket_handle, int conn_instance_id)
} }
} }
void GameClientMgr::AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick) void DownStreamMgr::AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick)
{ {
#if 0 #if 0
f8::UdpLog::Instance()->Info("AddPendingAccount %s %d", {account_id, socket_handle}); f8::UdpLog::Instance()->Info("AddPendingAccount %s %d", {account_id, socket_handle});
@ -123,7 +123,7 @@ void GameClientMgr::AddPendingAccount(const std::string& account_id, int socket_
.SetSender(socket_handle), .SetSender(socket_handle),
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
GameClientMgr::Instance()->pending_account_hash_.erase(param.sender); DownStreamMgr::Instance()->pending_account_hash_.erase(param.sender);
App::Instance()->perf.max_join_time = std::max((long long)1000 * 10, App::Instance()->perf.max_join_time); App::Instance()->perf.max_join_time = std::max((long long)1000 * 10, App::Instance()->perf.max_join_time);
}, },
&timer_attacher_.timer_list_ &timer_attacher_.timer_list_
@ -138,7 +138,7 @@ void GameClientMgr::AddPendingAccount(const std::string& account_id, int socket_
#endif #endif
} }
void GameClientMgr::RemovePendingAccount(int socket_handle) void DownStreamMgr::RemovePendingAccount(int socket_handle)
{ {
#if 0 #if 0
f8::UdpLog::Instance()->Info("RemovePendingAccount %d", {socket_handle}); f8::UdpLog::Instance()->Info("RemovePendingAccount %d", {socket_handle});

View File

@ -3,11 +3,11 @@
#include <f8/timer.h> #include <f8/timer.h>
class DownStream; class DownStream;
class GameClientMgr : public a8::Singleton<GameClientMgr> class DownStreamMgr : public a8::Singleton<DownStreamMgr>
{ {
private: private:
GameClientMgr() {}; DownStreamMgr() {};
friend class a8::Singleton<GameClientMgr>; friend class a8::Singleton<DownStreamMgr>;
public: public:

View File

@ -161,7 +161,7 @@ void MasterSvrMgr::RequestTargetServer(f8::MsgHdr& hdr,
if (req_handle_time > App::Instance()->perf.max_login_time) { if (req_handle_time > App::Instance()->perf.max_login_time) {
App::Instance()->perf.max_login_time = req_handle_time; App::Instance()->perf.max_login_time = req_handle_time;
} }
GameClientMgr::Instance()->AddPendingAccount(param.param2.GetString(), param.param1, param.param3); DownStreamMgr::Instance()->AddPendingAccount(param.param2.GetString(), param.param1, param.param3);
}; };
a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10, a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10,
a8::XParams() a8::XParams()