1
This commit is contained in:
parent
06d1314f29
commit
1279895717
@ -23,6 +23,16 @@ static int UdpOutput(const char *buf, int len, ikcpcb *kcp, void *user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KcpSession::KcpSession()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
KcpSession::~KcpSession()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void KcpSession::Init(int socket_handle)
|
void KcpSession::Init(int socket_handle)
|
||||||
{
|
{
|
||||||
socket_handle_ = 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非法数据包", {});
|
f8::UdpLog::Instance()->Warning("收到client非法数据包", {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -5,21 +5,26 @@
|
|||||||
|
|
||||||
#include "ikcp.h"
|
#include "ikcp.h"
|
||||||
|
|
||||||
class KcpSession
|
class KcpSession : public a8::UdpSession
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
KcpSession();
|
||||||
|
~KcpSession();
|
||||||
|
|
||||||
void Init(int socket_handle);
|
void Init(int socket_handle);
|
||||||
void UnInit();
|
void UnInit();
|
||||||
void Update(long long tick);
|
void Update(long long tick);
|
||||||
|
|
||||||
void SendClientMsg(char* buf, int buf_len);
|
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_; }
|
const sockaddr_in& GetAddr() const { return remote_addr_; }
|
||||||
void UpdateInput();
|
void UpdateInput();
|
||||||
int GetSocketHandle() { return socket_handle_; }
|
int GetSocketHandle() { return socket_handle_; }
|
||||||
long long GetSecretKey() { return secret_key_; }
|
long long GetSecretKey() { return secret_key_; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DecodeUserPacket(char* buf, int& offset, unsigned int buflen) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DecodePacket(char* buf, int& offset, unsigned int buflen);
|
void DecodePacket(char* buf, int& offset, unsigned int buflen);
|
||||||
|
|
||||||
|
2
third_party/a8
vendored
2
third_party/a8
vendored
@ -1 +1 @@
|
|||||||
Subproject commit cfdeca99aca94a4b89fd777abd928e51b4535037
|
Subproject commit e24aab092d253aab99b2d8e8a2ac4b3d635162e1
|
Loading…
x
Reference in New Issue
Block a user