From 1279895717c979148024508c6346186f92c7c063 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 23 Apr 2023 18:55:00 +0800 Subject: [PATCH] 1 --- server/wsproxy/kcpsession.cc | 15 +++++++++++++++ server/wsproxy/kcpsession.h | 9 +++++++-- third_party/a8 | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/server/wsproxy/kcpsession.cc b/server/wsproxy/kcpsession.cc index 0622f27..fa2bb8d 100644 --- a/server/wsproxy/kcpsession.cc +++ b/server/wsproxy/kcpsession.cc @@ -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) +{ + +} diff --git a/server/wsproxy/kcpsession.h b/server/wsproxy/kcpsession.h index a09ce11..8f102b2 100644 --- a/server/wsproxy/kcpsession.h +++ b/server/wsproxy/kcpsession.h @@ -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); diff --git a/third_party/a8 b/third_party/a8 index cfdeca9..e24aab0 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit cfdeca99aca94a4b89fd777abd928e51b4535037 +Subproject commit e24aab092d253aab99b2d8e8a2ac4b3d635162e1