40 lines
855 B
C++
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_;
|
|
};
|