From ff39b35c057e3b8a04ef2790278c4b9ca0a705b4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 15 Aug 2024 19:31:52 +0800 Subject: [PATCH] 1 --- server/wsproxy/CMakeLists.txt | 5 +++-- server/wsproxy/handlermgr.cc | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/wsproxy/CMakeLists.txt b/server/wsproxy/CMakeLists.txt index fda5acc..d89afe5 100644 --- a/server/wsproxy/CMakeLists.txt +++ b/server/wsproxy/CMakeLists.txt @@ -20,9 +20,10 @@ endif() set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG") if (${ASAN}) - set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -fsanitize=address -fno-omit-frame-pointer -fsanitize-recover=address") + message("asan mode") else() - set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -fsanitize-recover=address") endif() include_directories( diff --git a/server/wsproxy/handlermgr.cc b/server/wsproxy/handlermgr.cc index f54bd9f..7edad4c 100644 --- a/server/wsproxy/handlermgr.cc +++ b/server/wsproxy/handlermgr.cc @@ -46,6 +46,13 @@ static void _GMOpsGetKcpSwitch(int socket_handle, std::shared_ptrGetResp()->SetVal("is_open", JsonDataMgr::Instance()->GetKcpConf().open); } +static void _GMOpsTerminate(int socket_handle, std::shared_ptr request) +{ + request->GetResp()->SetVal("errcode", 0); + request->GetResp()->SetVal("errmsg", ""); + f8::App::Instance()->Terminate(); +} + static void _GMHttpTunnelTeamRequest(int socket_handle, std::shared_ptr request) { MasterMgr::Instance()->AddHttpTunnelRequest(socket_handle, request); @@ -63,6 +70,7 @@ void HandlerMgr::Init() RegisterGMMsgHandler("Ops$getNodeId", _GMOpsGetNodeId); RegisterGMMsgHandler("Ops$setKcpSwitch", _GMOpsSetKcpSwitch); RegisterGMMsgHandler("Ops$getKcpSwitch", _GMOpsGetKcpSwitch); + RegisterGMMsgHandler("Ops$terminate", _GMOpsTerminate); RegisterGMMsgHandler("HttpTunnel$teamRequest", _GMHttpTunnelTeamRequest); RegisterGMMsgHandler("HttpTunnel$onlineTeamRequest", _GMHttpTunnelOnlineTeamRequest); f8::MsgQueue::Instance()->RegisterCallBack