From a9a49026bb4a780bc616baece6c73369d69d522b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 20 Nov 2023 16:17:16 +0800 Subject: [PATCH] 1 --- server/gameserver/app.cc | 4 ++-- server/gameserver/app.h | 1 + server/gameserver/httpproxy.cc | 5 ++++- server/gameserver/roommgr.cc | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 5b9470dd..f5fc88f9 100644 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -233,10 +233,10 @@ void App::UnInit() { //const char* s2 = GetEnumString(); //int i = static_cast(Test_e::kFlyBuffId); - HttpProxy::Instance()->UnInit(); - GGListener::Instance()->UnInit(); PlayerMgr::Instance()->UnInit(); RoomMgr::Instance()->UnInit(); + HttpProxy::Instance()->UnInit(); + GGListener::Instance()->UnInit(); MapMgr::Instance()->UnInit(); MatchMgr::Instance()->UnInit(); KillMgr::Instance()->UnInit(); diff --git a/server/gameserver/app.h b/server/gameserver/app.h index dc54331c..9ce4e30e 100644 --- a/server/gameserver/app.h +++ b/server/gameserver/app.h @@ -39,6 +39,7 @@ public: long long AllocTempHeroUniId(); long long AllocTempWeaponUniId(); void Terminate() { terminated_ = true; } + bool Terminated() { return terminated_; } int GetInstanceId() const { return instance_id_; } int GetZoneId() const { return zone_id_; } int GetNodeId() const { return node_id_; } diff --git a/server/gameserver/httpproxy.cc b/server/gameserver/httpproxy.cc index a0719778..6638b9ed 100644 --- a/server/gameserver/httpproxy.cc +++ b/server/gameserver/httpproxy.cc @@ -58,7 +58,7 @@ void HttpProxy::Init() void HttpProxy::UnInit() { - + request_hash_.clear(); } std::string HttpProxy::HttpGet( @@ -67,6 +67,9 @@ std::string HttpProxy::HttpGet( a8::XObject url_params ) { + if (App::Instance()->Terminated()) { + return ""; + } std::shared_ptr request = std::make_shared(); request->req_id = CreateRequestId(); request->cb = cb; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 3d26afa8..fe97c2b7 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -84,9 +84,11 @@ void RoomMgr::Init() void RoomMgr::UnInit() { for (auto& pair : room_hash_) { + pair.second->ForceOver(); pair.second->UnInit(); } for (auto& pair : over_room_hash_) { + pair.second->ForceOver(); pair.second->UnInit(); } inactive_room_hash_.clear();