1
This commit is contained in:
parent
7f42fbcd94
commit
a26e6547cf
@ -49,9 +49,8 @@ void KcpSession::UnInit()
|
||||
}
|
||||
}
|
||||
|
||||
void KcpSession::Update()
|
||||
void KcpSession::Update(long long tick)
|
||||
{
|
||||
long long tick = a8::XGetTickCount();
|
||||
ikcp_update(kcp_, tick - init_tick_);
|
||||
UpdateInput();
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ public:
|
||||
|
||||
void Init(a8::UdpListener* udp_listener, int socket_handle, a8::UdpPacket* pkt);
|
||||
void UnInit();
|
||||
void Update();
|
||||
void Update(long long tick);
|
||||
|
||||
void SendClientMsg(char* buf, int buf_len);
|
||||
void OnRecvPacket(a8::UdpPacket* pkt);
|
||||
const sockaddr_in& GetAddr() const { return remote_addr_; }
|
||||
|
@ -15,15 +15,5 @@ void LongSession::UnInit()
|
||||
|
||||
void LongSession::Update(long long tick)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int LongSession::GetSocketHandle()
|
||||
{
|
||||
return kcp_session_->GetSocketHandle();
|
||||
}
|
||||
|
||||
long long LongSession::GetSecretKey()
|
||||
{
|
||||
return kcp_session_->GetSecretKey();
|
||||
GetKcpSession()->Update(tick);
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ class LongSession
|
||||
void UnInit();
|
||||
void Update(long long tick);
|
||||
|
||||
int GetSocketHandle();
|
||||
long long GetSecretKey();
|
||||
std::shared_ptr<KcpSession> GetKcpSession() { return kcp_session_; }
|
||||
|
||||
private:
|
||||
|
@ -55,7 +55,7 @@ void LongSessionMgr::ProcUdpPacket(a8::UdpPacket* pkt)
|
||||
int socket_handle = 0;
|
||||
long long secret_key = 0;
|
||||
auto session = GetSession(socket_handle);
|
||||
if (session && secret_key == session->GetSecretKey()) {
|
||||
if (session && secret_key == session->GetKcpSession()->GetSecretKey()) {
|
||||
session->GetKcpSession()->OnRecvPacket(pkt);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user