From 8a4e5ddc75a213ed015cb0861476b646d6ce2be7 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 13 Nov 2023 06:53:33 +0000 Subject: [PATCH] 1 --- server/wsproxy/app.cc | 3 +-- server/wsproxy/app.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index f4e3df3..9f988c1 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -90,7 +90,7 @@ const std::string App::GetPkgName() void App::Init() { - udp_msg_mutex_ = new std::mutex(); + udp_msg_mutex_ = std::make_shared(); HandlerMgr::Instance()->Init(); JsonDataMgr::Instance()->Init(); @@ -148,7 +148,6 @@ void App::UnInit() HandlerMgr::Instance()->UnInit(); FreeUdpMsgQueue(); - delete udp_msg_mutex_; udp_msg_mutex_ = nullptr; a8::XPrintf("wsproxy terminated instance_id:%d pid:%d\n", {f8::App::Instance()->GetInstanceId(), diff --git a/server/wsproxy/app.h b/server/wsproxy/app.h index 2358fbe..bbdc436 100644 --- a/server/wsproxy/app.h +++ b/server/wsproxy/app.h @@ -48,7 +48,7 @@ private: private: PerfMonitor perf_; - std::mutex* udp_msg_mutex_ = nullptr; + std::shared_ptr udp_msg_mutex_; UdpMsgNode* udp_top_node_ = nullptr; UdpMsgNode* udp_bot_node_ = nullptr; UdpMsgNode* udp_work_node_ = nullptr;