diff --git a/server/wsproxy/downstreammgr.cc b/server/wsproxy/downstreammgr.cc index 12746e3..0a4c040 100644 --- a/server/wsproxy/downstreammgr.cc +++ b/server/wsproxy/downstreammgr.cc @@ -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) diff --git a/server/wsproxy/mastermgr.cc b/server/wsproxy/mastermgr.cc index 8e30eec..15e8259 100644 --- a/server/wsproxy/mastermgr.cc +++ b/server/wsproxy/mastermgr.cc @@ -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 MasterMgr::GetRequestBySocket(int socket_handle) diff --git a/server/wsproxy/mastermgr.h b/server/wsproxy/mastermgr.h index 37d5c5d..41bf9e4 100644 --- a/server/wsproxy/mastermgr.h +++ b/server/wsproxy/mastermgr.h @@ -33,7 +33,7 @@ class MasterMgr : public a8::Singleton 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 GetRequestBySocket(int socket_handle);