From 0ec8f9133b45d0db74842ee1c2c9327678bdf0b9 Mon Sep 17 00:00:00 2001 From: azw Date: Mon, 24 Apr 2023 11:30:57 +0000 Subject: [PATCH] 1 --- server/wsproxy/jsondatamgr.cc | 20 ++++++++++---------- server/wsproxy/jsondatamgr.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index b84534c..f561c5b 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -18,16 +18,16 @@ void JsonDataMgr::Init() }); } - std::string wsproxyserver_cluster_json_file; - std::string masterserver_cluster_json_file; - wsproxyserver_cluster_json_file = a8::Format + std::string wsproxy_cluster_json_file; + std::string master_cluster_json_file; + wsproxy_cluster_json_file = a8::Format ("%s/node%d/game%d.wsproxy.cluster.json", { work_path_, App::Instance()->GetNodeId(), GAME_ID }); - masterserver_cluster_json_file = a8::Format + master_cluster_json_file = a8::Format ("%s/node%d/game%d.masterserver.cluster.json", { work_path_, @@ -35,8 +35,8 @@ void JsonDataMgr::Init() GAME_ID }); - wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file); - masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file); + wsproxy_cluster_json_.ReadFromFile(wsproxy_cluster_json_file); + master_cluster_json_.ReadFromFile(master_cluster_json_file); udp_host_ = GetConf()->At("listen_udp_host")->AsXValue().GetString(); udp_port_ = GetConf()->At("listen_udp_port")->AsXValue(); } @@ -47,8 +47,8 @@ void JsonDataMgr::UnInit() std::shared_ptr JsonDataMgr::GetConf() { - for (int i = 0; i < wsproxyserver_cluster_json_.Size(); ++i) { - std::shared_ptr conf = wsproxyserver_cluster_json_.At(i); + for (int i = 0; i < wsproxy_cluster_json_.Size(); ++i) { + std::shared_ptr conf = wsproxy_cluster_json_.At(i); if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->GetInstanceId()) { return conf; } @@ -58,8 +58,8 @@ std::shared_ptr JsonDataMgr::GetConf() void JsonDataMgr::TraverseMaster(std::function cb) { - for (int i = 0; i < masterserver_cluster_json_.Size(); ++i) { - auto master_svr_conf = masterserver_cluster_json_.At(i); + for (int i = 0; i < master_cluster_json_.Size(); ++i) { + auto master_svr_conf = master_cluster_json_.At(i); int instance_id = master_svr_conf->At("instance_id")->AsXValue(); std::string remote_ip = master_svr_conf->At("ip")->AsXValue(); int remote_port = master_svr_conf->At("port")->AsXValue(); diff --git a/server/wsproxy/jsondatamgr.h b/server/wsproxy/jsondatamgr.h index a4cbb52..b87b660 100644 --- a/server/wsproxy/jsondatamgr.h +++ b/server/wsproxy/jsondatamgr.h @@ -19,8 +19,8 @@ class JsonDataMgr : public a8::Singleton private: std::string work_path_ = "../config"; - a8::XObject wsproxyserver_cluster_json_; - a8::XObject masterserver_cluster_json_; + a8::XObject wsproxy_cluster_json_; + a8::XObject master_cluster_json_; std::string udp_host_; int udp_port_ = 0; };