This commit is contained in:
aozhiwei 2023-04-24 13:22:53 +08:00
parent 55268bb0fd
commit b9f09fd360
2 changed files with 14 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -33,7 +33,9 @@ class GCListener : public a8::Singleton<GCListener>
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<int, std::tuple<std::string, std::string>> websocket_url_hash_;
};