diff --git a/server/wsproxy/GCListener.cc b/server/wsproxy/GCListener.cc index a75d7df..5261ab6 100644 --- a/server/wsproxy/GCListener.cc +++ b/server/wsproxy/GCListener.cc @@ -169,3 +169,15 @@ long long GCListener::GetSentBytesNum() { return tcp_listener_->sent_bytes_num; } + +bool GCListener::GetWebSocketUrl(int socket_handle, std::string& url, std::string& query_str) +{ + auto itr = websocket_url_hash_.find(socket_handle); + if (itr != websocket_url_hash_.end()) { + url = std::get<0>(itr->second); + query_str = std::get<1>(itr->second); + return true; + } else { + return false; + } +} diff --git a/server/wsproxy/GCListener.h b/server/wsproxy/GCListener.h index 4e41c7c..c045f27 100644 --- a/server/wsproxy/GCListener.h +++ b/server/wsproxy/GCListener.h @@ -33,7 +33,9 @@ class GCListener : public a8::Singleton void MarkClient(unsigned short sockhandle, bool is_active); long long GetSendNodeNum(); long long GetSentBytesNum(); + bool GetWebSocketUrl(int socket_handle, std::string& url, std::string& query_str); private: a8::TcpListener *tcp_listener_ = nullptr; + std::map> websocket_url_hash_; };