This commit is contained in:
azw 2023-06-05 09:36:21 +00:00
parent 90d4fbac8c
commit 36f7099354
5 changed files with 26 additions and 0 deletions

View File

@ -24,6 +24,7 @@ message SS_CMKcpHandshake
optional string account_id = 2; //id optional string account_id = 2; //id
optional string session_id = 3; //session id optional string session_id = 3; //session id
optional string team_uuid = 4; // optional string team_uuid = 4; //
optional int32 secret_key_place = 5; // 0() 1kcp底层协议头之后()
} }
message SS_SMKcpHandshake message SS_SMKcpHandshake

View File

@ -127,3 +127,13 @@ void KcpSession::DecodeUserPacket(char* buf, int& offset, unsigned int buflen)
f8::UdpLog::Instance()->Warning("收到kcp client非法数据包", {}); f8::UdpLog::Instance()->Warning("收到kcp client非法数据包", {});
} }
} }
void KcpSession::SetSecretKeyPlace(int secret_key_place)
{
secret_key_place_ = secret_key_place;
}
int KcpSession::GetSecretKeyPlace()
{
return secret_key_place_;
}

View File

@ -19,6 +19,8 @@ public:
int GetSocketHandle() { return socket_handle_; } int GetSocketHandle() { return socket_handle_; }
long long GetSecretKey() { return secret_key_; } long long GetSecretKey() { return secret_key_; }
void* GetSecretKeyDataPtr() { return &secret_key_; } void* GetSecretKeyDataPtr() { return &secret_key_; }
void SetSecretKeyPlace(int secret_key_place);
int GetSecretKeyPlace();
void SendClientMsg(char* buf, int buf_len); void SendClientMsg(char* buf, int buf_len);
virtual void OnRecvPacket(a8::UdpPacket* pkt) override; virtual void OnRecvPacket(a8::UdpPacket* pkt) override;
@ -36,6 +38,7 @@ private:
void UpdateInput(); void UpdateInput();
private: private:
int secret_key_place_ = 0;
int socket_handle_ = 0; int socket_handle_ = 0;
long long secret_key_ = 0; long long secret_key_ = 0;
ikcpcb* kcp_ = nullptr; ikcpcb* kcp_ = nullptr;

View File

@ -25,3 +25,13 @@ void LongSession::UpdatePing()
{ {
last_ping_tick_ = a8::XGetTickCount(); 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();
}

View File

@ -17,6 +17,8 @@ class LongSession
std::shared_ptr<KcpSession> GetKcpSession() { return kcp_session_; } std::shared_ptr<KcpSession> GetKcpSession() { return kcp_session_; }
void UpdatePing(); void UpdatePing();
void SetSecretKeyPlace(int secret_key_place);
int GetSecretKeyPlace();
private: private:
long long last_ping_tick_ = 0; long long last_ping_tick_ = 0;