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);