wsproxy/server/wsproxy/longsessionmgr.h
2023-04-25 07:00:25 +00:00

40 lines
855 B
C++

#pragma once
#include <a8/singleton.h>
namespace a8
{
class UdpListener;
struct UdpPacket;
}
namespace ss
{
class SS_CMKcpHandshake;
}
class LongSession;
class LongSessionMgr : public a8::Singleton<LongSessionMgr>
{
private:
LongSessionMgr() {};
friend class a8::Singleton<LongSessionMgr>;
public:
void Init();
void UnInit();
void Update();
void _SS_CMKcpHandshake(f8::MsgHdr& hdr, const ss::SS_CMKcpHandshake& msg);
void ProcUdpPacket(a8::UdpPacket* pkt);
std::shared_ptr<LongSession> GetSession(int socket_handle);
std::shared_ptr<a8::UdpListener> GetUdpListener() { return udp_listener_; }
void DelSession(int socket_handle);
int GetLongSessionCount();
private:
std::shared_ptr<a8::UdpListener> udp_listener_;
std::map<int, std::shared_ptr<LongSession>> socket_handle_hash_;
};