This commit is contained in:
azw 2023-04-17 06:37:54 +00:00
parent 9de27d574f
commit a35add02b6
2 changed files with 15 additions and 1 deletions

View File

@ -228,7 +228,19 @@ long long GCListener::GetSentBytesNum()
return tcp_listener_->sent_bytes_num; return tcp_listener_->sent_bytes_num;
} }
std::shared_ptr<KcpSession> GCListener::GetKcpSessionByRemoteKey(long long key)
{
auto itr = kcp_session_addr_hash_.find(key);
return itr != kcp_session_addr_hash_.end() ? itr->second : nullptr;
}
std::shared_ptr<KcpSession> GCListener::GetKcpSessionBySocketHandle(int socket_handle)
{
auto itr = kcp_session_handle_hash_.find(socket_handle);
return itr != kcp_session_handle_hash_.end() ? itr->second : nullptr;
}
void GCListener::ProcUdpPacket(a8::UdpPacket* pkt) void GCListener::ProcUdpPacket(a8::UdpPacket* pkt)
{ {
long long key = pkt->GetRemoteKey();
} }

View File

@ -37,6 +37,8 @@ class GCListener : public a8::Singleton<GCListener>
long long GetSendNodeNum(); long long GetSendNodeNum();
long long GetSentBytesNum(); long long GetSentBytesNum();
std::shared_ptr<KcpSession> GetKcpSessionByRemoteKey(long long key);
std::shared_ptr<KcpSession> GetKcpSessionBySocketHandle(int socket_handle);
void ProcUdpPacket(a8::UdpPacket* pkt); void ProcUdpPacket(a8::UdpPacket* pkt);
private: private: