This commit is contained in:
azw 2023-04-13 23:03:47 +00:00
parent fb9fefd1aa
commit 452f337b9f
3 changed files with 14 additions and 23 deletions

View File

@ -50,7 +50,7 @@ void DownStreamMgr::OnClientDisconnect(int socket_handle)
socket_hash_.erase(socket_handle); socket_hash_.erase(socket_handle);
} }
RemovePendingAccount(socket_handle); RemovePendingAccount(socket_handle);
MasterMgr::Instance()->RemoveRequest(socket_handle, 0, true); MasterMgr::Instance()->RemoveRequest(socket_handle);
} }
void DownStreamMgr::OnUpStreamDisconnect(int instance_id) void DownStreamMgr::OnUpStreamDisconnect(int instance_id)

View File

@ -53,8 +53,6 @@ void MasterMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_Res
{ {
auto req = GetRequestByContextId(msg.context_id()); auto req = GetRequestByContextId(msg.context_id());
if (req) { if (req) {
#if 0
int socket_handle = context_hdr->socket_handle;
if (msg.error_code() == 0) { if (msg.error_code() == 0) {
UpStream* conn = UpStreamMgr::Instance()->RecreateUpStream UpStream* conn = UpStreamMgr::Instance()->RecreateUpStream
( (
@ -62,15 +60,14 @@ void MasterMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr& hdr, const ss::SS_MS_Res
msg.port() msg.port()
); );
if (conn) { if (conn) {
RemoveRequest(socket_handle, msg.context_id(), false); RemoveRequest(req->hdr_copy->socket_handle);
conn->ForwardClientMsgEx(context_hdr); conn->ForwardClientMsgEx(req->hdr_copy);
return; return;
} else { } else {
abort(); abort();
} }
} }
RemoveRequest(socket_handle, msg.context_id(), true); RemoveRequest(req->hdr_copy->socket_handle);
#endif
} }
} }
@ -131,9 +128,7 @@ void MasterMgr::RequestTargetServer(f8::MsgHdr& hdr,
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
MasterMgr::Instance()->RemoveRequest MasterMgr::Instance()->RemoveRequest
( (
req->hdr_copy->socket_handle, req->hdr_copy->socket_handle
req->context_id,
true
); );
long long req_handle_time = a8::XGetTickCount() - req->req_tick; long long req_handle_time = a8::XGetTickCount() - req->req_tick;
if (req_handle_time > App::Instance()->perf.max_login_time) { if (req_handle_time > App::Instance()->perf.max_login_time) {
@ -146,23 +141,19 @@ void MasterMgr::RequestTargetServer(f8::MsgHdr& hdr,
} }
} }
void MasterMgr::RemoveRequest(int socket_handle, long long context_id, bool auto_free) void MasterMgr::RemoveRequest(int socket_handle)
{ {
#if 0 auto req = GetRequestBySocket(socket_handle);
if (context_id == GetContextIdBySocket(socket_handle)) { if (req) {
auto req = GetRequestByContextId(context_id); if (req->hdr_copy) {
if (req) { if (req->hdr_copy->buf) {
if (auto_free) { free((char*)req->hdr_copy->buf);
if (req->hdr_copy->buf) {
free((char*)req->hdr_copy->buf);
}
free(req->hdr_copy);
} }
free(req->hdr_copy);
} }
pending_context_hash_.erase(context_id); pending_context_hash_.erase(req->context_id);
pending_socket_hash_.erase(socket_handle); pending_socket_hash_.erase(socket_handle);
} }
#endif
} }
std::shared_ptr<RequestTarget> MasterMgr::GetRequestBySocket(int socket_handle) std::shared_ptr<RequestTarget> MasterMgr::GetRequestBySocket(int socket_handle)

View File

@ -33,7 +33,7 @@ class MasterMgr : public a8::Singleton<MasterMgr>
const std::string& server_info, const std::string& server_info,
int is_reconnect, int is_reconnect,
int proto_version); int proto_version);
void RemoveRequest(int socket_handle, long long context_id, bool auto_free); void RemoveRequest(int socket_handle);
private: private:
std::shared_ptr<RequestTarget> GetRequestBySocket(int socket_handle); std::shared_ptr<RequestTarget> GetRequestBySocket(int socket_handle);