This commit is contained in:
aozhiwei 2023-04-23 19:05:03 +08:00
parent 5447397c21
commit 8e251100d2
3 changed files with 7 additions and 0 deletions

View File

@ -606,3 +606,8 @@ void App::DispatchUdpMsg()
working_msgnode_size_ = 0; working_msgnode_size_ = 0;
} }
} }
long long App::NewUuid()
{
return uuid.Generate();
}

View File

@ -35,6 +35,7 @@ class App : public a8::Singleton<App>
void NotifyLoopCond(); void NotifyLoopCond();
bool HasFlag(int flag); bool HasFlag(int flag);
long long NewUuid();
private: private:
void QuickExecute(); void QuickExecute();

View File

@ -36,6 +36,7 @@ KcpSession::~KcpSession()
void KcpSession::Init(int socket_handle) void KcpSession::Init(int socket_handle)
{ {
socket_handle_ = socket_handle; socket_handle_ = socket_handle;
secret_key_ = App::Instance()->NewUuid();
kcp_ = ikcp_create(socket_handle_, (void*)this); kcp_ = ikcp_create(socket_handle_, (void*)this);
ikcp_wndsize(kcp_, 128, 128); ikcp_wndsize(kcp_, 128, 128);
ikcp_nodelay(kcp_, 2, 10, 2, 1); ikcp_nodelay(kcp_, 2, 10, 2, 1);