This commit is contained in:
aozhiwei 2023-11-18 12:29:35 +08:00
parent 56f576e60d
commit 9dcbd24fd4

View File

@ -35,12 +35,13 @@ namespace a8
void Close(); void Close();
bool IsActive(); bool IsActive();
template <typename T> template <typename T>
void RegisterSessionClass() void RegisterSessionClass(int max_packet_len)
{ {
on_create_client_socket_ = on_create_client_socket_ =
[] (a8::TcpSession** p) [max_packet_len] (a8::TcpSession** p)
{ {
*p = new T; *p = new T;
(*p)->SetMaxPacketLen(max_packet_len);
}; };
} }
bool SendClientMsg(unsigned short sockhandle, const char *buff, int buffLen); bool SendClientMsg(unsigned short sockhandle, const char *buff, int buffLen);