From 8a6b80fa4e41ac4f67f1126b718966d0162544b4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 24 Apr 2023 10:26:42 +0800 Subject: [PATCH] 1 --- server/wsproxy/app.cc | 4 ++-- server/wsproxy/downstreammgr.cc | 6 +++--- server/wsproxy/downstreammgr.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index 4b6b95a..8da030e 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -368,7 +368,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr) if (hdr.msgid == ss::_SS_CMLogin || hdr.msgid == ss::_SS_CMReconnect || hdr.msgid == ss::_SS_CMKcpHandshake) { - auto down_wp = DownStreamMgr::Instance()->GetGameClientBySocket(hdr.socket_handle); + auto down_wp = DownStreamMgr::Instance()->GetDownStream(hdr.socket_handle); if (down_wp.expired()) { switch (hdr.msgid) { case ss::_SS_CMLogin: @@ -418,7 +418,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr) } } } else { - auto down_wp = DownStreamMgr::Instance()->GetGameClientBySocket(hdr.socket_handle); + auto down_wp = DownStreamMgr::Instance()->GetDownStream(hdr.socket_handle); if (auto down = down_wp.lock(); !down_wp.expired()) { if (!down->conn.expired()) { down->conn.lock()->ForwardClientMsg(hdr); diff --git a/server/wsproxy/downstreammgr.cc b/server/wsproxy/downstreammgr.cc index 035bf45..06c6db4 100644 --- a/server/wsproxy/downstreammgr.cc +++ b/server/wsproxy/downstreammgr.cc @@ -41,7 +41,7 @@ void DownStreamMgr::UnInit() void DownStreamMgr::OnClientDisconnect(int socket_handle) { - auto down_wp = GetGameClientBySocket(socket_handle); + auto down_wp = GetDownStream(socket_handle); if (auto down = down_wp.lock(); !down_wp.expired()) { if (!down->conn.expired()) { ss::SS_WSP_SocketDisconnect msg; @@ -73,7 +73,7 @@ void DownStreamMgr::OnUpStreamConnect(int instance_id) } -std::weak_ptr DownStreamMgr::GetGameClientBySocket(int sockhandle) +std::weak_ptr DownStreamMgr::GetDownStream(int sockhandle) { auto itr = socket_hash_.find(sockhandle); return itr != socket_hash_.end() ? itr->second : nullptr; @@ -83,7 +83,7 @@ void DownStreamMgr::BindUpStream(int socket_handle, int conn_instance_id) { std::weak_ptr conn = UpStreamMgr::Instance()->GetConnById(conn_instance_id); if (!conn.expired()) { - auto down_wp = GetGameClientBySocket(socket_handle); + auto down_wp = GetDownStream(socket_handle); if (auto down = down_wp.lock(); !down_wp.expired()) { down->conn = conn; } else { diff --git a/server/wsproxy/downstreammgr.h b/server/wsproxy/downstreammgr.h index 6afdf76..a4465ef 100644 --- a/server/wsproxy/downstreammgr.h +++ b/server/wsproxy/downstreammgr.h @@ -17,7 +17,7 @@ class DownStreamMgr : public a8::Singleton void OnUpStreamDisconnect(int instance_id); void OnUpStreamConnect(int instance_id); - std::weak_ptr GetGameClientBySocket(int sockhande); + std::weak_ptr GetDownStream(int sockhande); void BindUpStream(int socket_handle, int conn_instance_id); void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick);