From 8e251100d22501199ee070d03bf97ddff4edb011 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 23 Apr 2023 19:05:03 +0800 Subject: [PATCH] 1 --- server/wsproxy/app.cc | 5 +++++ server/wsproxy/app.h | 1 + server/wsproxy/kcpsession.cc | 1 + 3 files changed, 7 insertions(+) diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index bd37b65..e7af352 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -606,3 +606,8 @@ void App::DispatchUdpMsg() working_msgnode_size_ = 0; } } + +long long App::NewUuid() +{ + return uuid.Generate(); +} diff --git a/server/wsproxy/app.h b/server/wsproxy/app.h index ff6ef8f..bfb896c 100644 --- a/server/wsproxy/app.h +++ b/server/wsproxy/app.h @@ -35,6 +35,7 @@ class App : public a8::Singleton void NotifyLoopCond(); bool HasFlag(int flag); + long long NewUuid(); private: void QuickExecute(); diff --git a/server/wsproxy/kcpsession.cc b/server/wsproxy/kcpsession.cc index 007b8e1..2549253 100644 --- a/server/wsproxy/kcpsession.cc +++ b/server/wsproxy/kcpsession.cc @@ -36,6 +36,7 @@ KcpSession::~KcpSession() void KcpSession::Init(int socket_handle) { socket_handle_ = socket_handle; + secret_key_ = App::Instance()->NewUuid(); kcp_ = ikcp_create(socket_handle_, (void*)this); ikcp_wndsize(kcp_, 128, 128); ikcp_nodelay(kcp_, 2, 10, 2, 1);