aozhiwei d388471db0 1
2020-06-16 11:02:06 +08:00

44 lines
811 B
C++

#pragma once
//game client listener
namespace a8
{
class TcpListener;
}
namespace ss
{
class SS_Ping;
}
class GGListener : public a8::Singleton<GGListener>
{
public:
enum { HID = HID_SvrMgr };
private:
GGListener() {};
friend class a8::Singleton<GGListener>;
public:
void Init();
void UnInit();
template <typename T>
void SendMsg(int sockhandle, T& msg)
{
static int msgid = f8::Net_GetMessageId(msg);
f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg);
}
void SendText(int sockhandle, const std::string& text);
void ForceCloseClient(int sockhandle);
void MarkClient(int sockhandle, bool is_active);
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
private:
a8::TcpListener *tcp_listener_ = nullptr;
};