This commit is contained in:
aozhiwei 2023-04-24 10:26:42 +08:00
parent f1e98da3c9
commit 8a6b80fa4e
3 changed files with 6 additions and 6 deletions

View File

@ -368,7 +368,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
if (hdr.msgid == ss::_SS_CMLogin || if (hdr.msgid == ss::_SS_CMLogin ||
hdr.msgid == ss::_SS_CMReconnect || hdr.msgid == ss::_SS_CMReconnect ||
hdr.msgid == ss::_SS_CMKcpHandshake) { 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()) { if (down_wp.expired()) {
switch (hdr.msgid) { switch (hdr.msgid) {
case ss::_SS_CMLogin: case ss::_SS_CMLogin:
@ -418,7 +418,7 @@ void App::ProcessClientMsg(f8::MsgHdr& hdr)
} }
} }
} else { } 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 (auto down = down_wp.lock(); !down_wp.expired()) {
if (!down->conn.expired()) { if (!down->conn.expired()) {
down->conn.lock()->ForwardClientMsg(hdr); down->conn.lock()->ForwardClientMsg(hdr);

View File

@ -41,7 +41,7 @@ void DownStreamMgr::UnInit()
void DownStreamMgr::OnClientDisconnect(int socket_handle) 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 (auto down = down_wp.lock(); !down_wp.expired()) {
if (!down->conn.expired()) { if (!down->conn.expired()) {
ss::SS_WSP_SocketDisconnect msg; ss::SS_WSP_SocketDisconnect msg;
@ -73,7 +73,7 @@ void DownStreamMgr::OnUpStreamConnect(int instance_id)
} }
std::weak_ptr<DownStream> DownStreamMgr::GetGameClientBySocket(int sockhandle) std::weak_ptr<DownStream> DownStreamMgr::GetDownStream(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;
@ -83,7 +83,7 @@ void DownStreamMgr::BindUpStream(int socket_handle, int conn_instance_id)
{ {
std::weak_ptr<UpStream> conn = UpStreamMgr::Instance()->GetConnById(conn_instance_id); std::weak_ptr<UpStream> conn = UpStreamMgr::Instance()->GetConnById(conn_instance_id);
if (!conn.expired()) { if (!conn.expired()) {
auto down_wp = GetGameClientBySocket(socket_handle); auto down_wp = GetDownStream(socket_handle);
if (auto down = down_wp.lock(); !down_wp.expired()) { if (auto down = down_wp.lock(); !down_wp.expired()) {
down->conn = conn; down->conn = conn;
} else { } else {

View File

@ -17,7 +17,7 @@ class DownStreamMgr : public a8::Singleton<DownStreamMgr>
void OnUpStreamDisconnect(int instance_id); void OnUpStreamDisconnect(int instance_id);
void OnUpStreamConnect(int instance_id); void OnUpStreamConnect(int instance_id);
std::weak_ptr<DownStream> GetGameClientBySocket(int sockhande); std::weak_ptr<DownStream> GetDownStream(int sockhande);
void BindUpStream(int socket_handle, int conn_instance_id); void BindUpStream(int socket_handle, int conn_instance_id);
void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick); void AddPendingAccount(const std::string& account_id, int socket_handle, long long req_tick);