1
This commit is contained in:
parent
4ad5bbdc1e
commit
7f42fbcd94
@ -13,6 +13,11 @@ void LongSession::UnInit()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LongSession::Update(long long tick)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int LongSession::GetSocketHandle()
|
int LongSession::GetSocketHandle()
|
||||||
{
|
{
|
||||||
return kcp_session_->GetSocketHandle();
|
return kcp_session_->GetSocketHandle();
|
||||||
|
@ -8,8 +8,11 @@ class LongSession
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void UnInit();
|
void UnInit();
|
||||||
|
void Update(long long tick);
|
||||||
|
|
||||||
int GetSocketHandle();
|
int GetSocketHandle();
|
||||||
long long GetSecretKey();
|
long long GetSecretKey();
|
||||||
|
std::shared_ptr<KcpSession> GetKcpSession() { return kcp_session_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<KcpSession> kcp_session_;
|
std::shared_ptr<KcpSession> kcp_session_;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
#include "longsession.h"
|
#include "longsession.h"
|
||||||
|
#include "kcpsession.h"
|
||||||
|
|
||||||
static void GSUdpListeneron_error(int errorid)
|
static void GSUdpListeneron_error(int errorid)
|
||||||
{
|
{
|
||||||
@ -37,7 +38,10 @@ void LongSessionMgr::UnInit()
|
|||||||
|
|
||||||
void LongSessionMgr::Update()
|
void LongSessionMgr::Update()
|
||||||
{
|
{
|
||||||
|
long long tick = a8::XGetTickCount();
|
||||||
|
for (auto& pair : socket_handle_hash_) {
|
||||||
|
pair.second->Update(tick);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<LongSession> LongSessionMgr::GetSession(int socket_handle)
|
std::shared_ptr<LongSession> LongSessionMgr::GetSession(int socket_handle)
|
||||||
@ -52,8 +56,6 @@ void LongSessionMgr::ProcUdpPacket(a8::UdpPacket* pkt)
|
|||||||
long long secret_key = 0;
|
long long secret_key = 0;
|
||||||
auto session = GetSession(socket_handle);
|
auto session = GetSession(socket_handle);
|
||||||
if (session && secret_key == session->GetSecretKey()) {
|
if (session && secret_key == session->GetSecretKey()) {
|
||||||
#if 0
|
session->GetKcpSession()->OnRecvPacket(pkt);
|
||||||
session->OnRecvPacket(pkt);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user