1
This commit is contained in:
parent
36f7099354
commit
39b01b2794
@ -33,7 +33,7 @@ KcpSession::~KcpSession()
|
||||
|
||||
}
|
||||
|
||||
void KcpSession::Init(int socket_handle)
|
||||
void KcpSession::Init(int socket_handle, int secret_key_place)
|
||||
{
|
||||
socket_handle_ = socket_handle;
|
||||
secret_key_ = App::Instance()->NewUuid();
|
||||
@ -50,6 +50,7 @@ void KcpSession::Init(int socket_handle)
|
||||
kcp_->rx_minrto = 10;
|
||||
kcp_->fastresend = 1;
|
||||
#endif
|
||||
secret_key_place_ = secret_key_place;
|
||||
kcp_->output = UdpOutput;
|
||||
init_tick_ = a8::XGetTickCount();
|
||||
}
|
||||
@ -128,11 +129,6 @@ void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen)
|
||||
}
|
||||
}
|
||||
|
||||
void KcpSession::SetSecretKeyPlace(int secret_key_place)
|
||||
{
|
||||
secret_key_place_ = secret_key_place;
|
||||
}
|
||||
|
||||
int KcpSession::GetSecretKeyPlace()
|
||||
{
|
||||
return secret_key_place_;
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
KcpSession();
|
||||
~KcpSession();
|
||||
|
||||
void Init(int socket_handle);
|
||||
void Init(int socket_handle, int secret_key_place);
|
||||
void UnInit();
|
||||
void Update(long long tick);
|
||||
|
||||
@ -19,7 +19,6 @@ public:
|
||||
int GetSocketHandle() { return socket_handle_; }
|
||||
long long GetSecretKey() { return secret_key_; }
|
||||
void* GetSecretKeyDataPtr() { return &secret_key_; }
|
||||
void SetSecretKeyPlace(int secret_key_place);
|
||||
int GetSecretKeyPlace();
|
||||
|
||||
void SendClientMsg(char* buf, int buf_len);
|
||||
|
@ -5,10 +5,13 @@
|
||||
#include "longsession.h"
|
||||
#include "kcpsession.h"
|
||||
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
void LongSession::Init(f8::MsgHdr& hdr, const ss::SS_CMKcpHandshake& msg)
|
||||
{
|
||||
kcp_session_ = std::make_shared<KcpSession>();
|
||||
kcp_session_->Init(hdr.socket_handle);
|
||||
kcp_session_->Init(hdr.socket_handle, msg.secret_key_place());
|
||||
}
|
||||
|
||||
void LongSession::UnInit()
|
||||
@ -26,11 +29,6 @@ void LongSession::UpdatePing()
|
||||
last_ping_tick_ = a8::XGetTickCount();
|
||||
}
|
||||
|
||||
void LongSession::SetSecretKeyPlace(int secret_key_place)
|
||||
{
|
||||
kcp_session_->SetSecretKeyPlace(secret_key_place);
|
||||
}
|
||||
|
||||
int LongSession::GetSecretKeyPlace()
|
||||
{
|
||||
return kcp_session_->GetSecretKeyPlace();
|
||||
|
@ -17,7 +17,6 @@ class LongSession
|
||||
|
||||
std::shared_ptr<KcpSession> GetKcpSession() { return kcp_session_; }
|
||||
void UpdatePing();
|
||||
void SetSecretKeyPlace(int secret_key_place);
|
||||
int GetSecretKeyPlace();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user