From b3f165760b79607ee0d783f1ed62ecd61b60ff7c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 24 Mar 2024 13:35:56 +0800 Subject: [PATCH] 1 --- server/wsproxy/mastermgr.cc | 8 ++++---- server/wsproxy/mastermgr.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/wsproxy/mastermgr.cc b/server/wsproxy/mastermgr.cc index 0ebf3aa..2c333be 100644 --- a/server/wsproxy/mastermgr.cc +++ b/server/wsproxy/mastermgr.cc @@ -234,19 +234,19 @@ std::shared_ptr MasterMgr::GetRequestByContextId(long long contex void MasterMgr::AddHttpTunnelRequest(int socket_handle, std::shared_ptr request) { - pending_http_tunnel_hash_[socket_handle] = request; + pending_http_tunnel_socket_hash_[socket_handle] = request; } void MasterMgr::RemoveHttpTunnelRequest(int socket_handle) { auto req = GetHttpTunnelRequest(socket_handle); if (req) { - pending_http_tunnel_hash_.end(); + pending_http_tunnel_socket_hash_.end(); } } std::shared_ptr MasterMgr::GetHttpTunnelRequest(int socket_handle) { - auto itr = pending_http_tunnel_hash_.find(socket_handle); - return itr != pending_http_tunnel_hash_.end() ? itr->second : nullptr; + auto itr = pending_http_tunnel_socket_hash_.find(socket_handle); + return itr != pending_http_tunnel_socket_hash_.end() ? itr->second : nullptr; } diff --git a/server/wsproxy/mastermgr.h b/server/wsproxy/mastermgr.h index 1da2981..87fe77c 100644 --- a/server/wsproxy/mastermgr.h +++ b/server/wsproxy/mastermgr.h @@ -38,18 +38,20 @@ class MasterMgr : public a8::Singleton int proto_version); void RemoveRequest(int socket_handle); void AddHttpTunnelRequest(int socket_handle, std::shared_ptr request); - void RemoveHttpTunnelRequest(int socket_handle); private: std::shared_ptr GetHttpTunnelRequest(int socket_handle); std::shared_ptr GetRequestBySocket(int socket_handle); std::shared_ptr GetRequestByContextId(long long context_id); std::shared_ptr GetConnById(int instance_id); + void RemoveHttpTunnelRequest(int socket_handle); private: long long curr_context_id_ = 0; std::map> mastersvr_hash_; + std::map> pending_socket_hash_; std::map> pending_context_hash_; - std::map> pending_http_tunnel_hash_; + + std::map> pending_http_tunnel_socket_hash_; };