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