This commit is contained in:
aozhiwei 2023-04-23 18:55:00 +08:00
parent 06d1314f29
commit 1279895717
3 changed files with 23 additions and 3 deletions

View File

@ -23,6 +23,16 @@ static int UdpOutput(const char *buf, int len, ikcpcb *kcp, void *user)
return 0;
}
KcpSession::KcpSession()
{
}
KcpSession::~KcpSession()
{
}
void KcpSession::Init(int socket_handle)
{
socket_handle_ = socket_handle;
@ -140,3 +150,8 @@ void KcpSession::DecodePacket(char* buf, int& offset, unsigned int buflen)
f8::UdpLog::Instance()->Warning("收到client非法数据包", {});
}
}
void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen)
{
}

View File

@ -5,21 +5,26 @@
#include "ikcp.h"
class KcpSession
class KcpSession : public a8::UdpSession
{
public:
KcpSession();
~KcpSession();
void Init(int socket_handle);
void UnInit();
void Update(long long tick);
void SendClientMsg(char* buf, int buf_len);
void OnRecvPacket(a8::UdpPacket* pkt);
virtual void OnRecvPacket(a8::UdpPacket* pkt) override;
const sockaddr_in& GetAddr() const { return remote_addr_; }
void UpdateInput();
int GetSocketHandle() { return socket_handle_; }
long long GetSecretKey() { return secret_key_; }
protected:
virtual void DecodeUserPacket(char* buf, int& offset, unsigned int buflen) override;
private:
void DecodePacket(char* buf, int& offset, unsigned int buflen);

2
third_party/a8 vendored

@ -1 +1 @@
Subproject commit cfdeca99aca94a4b89fd777abd928e51b4535037
Subproject commit e24aab092d253aab99b2d8e8a2ac4b3d635162e1