From ab595fbafbca7136afbf728cb209ad12709b5afe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 13 Dec 2019 13:06:04 +0800 Subject: [PATCH] 1 --- server/wsproxy/jsondatamgr.cc | 100 +++++++++++++++++----------------- server/wsproxy/jsondatamgr.h | 1 + 2 files changed, 52 insertions(+), 49 deletions(-) diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index 0a70f3c..a017d61 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -11,56 +11,58 @@ void JsonDataMgr::Init() node_host_mutex_ = new std::mutex(); #endif - std::string wsproxyserver_cluster_json_file; - std::string masterserver_cluster_json_file; - std::string targetserver_cluster_json_file; - std::string routing_tables_json_file; - if (f8::IsOnlineEnv()) { -#if MASTER_MODE - wsproxyserver_cluster_json_file = a8::Format("../config/node%d/game%d.wsproxy.cluster.json", - { - App::Instance()->node_id, - GAME_ID - }); - masterserver_cluster_json_file = a8::Format("../config/node%d/game%d.masterserver.cluster.json", - { - App::Instance()->node_id, - GAME_ID - }); - routing_tables_json_file = a8::Format("../config/routing_tables.json", - { - }); -#else - wsproxyserver_cluster_json_file = a8::Format("../config/game%d.wsproxy.cluster.json", {GAME_ID}); - masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID}); -#endif - } else { -#if MASTER_MODE - wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.wsproxy.cluster.json", - { - GAME_ID, - App::Instance()->node_id, - GAME_ID - }); - masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.masterserver.cluster.json", - { - GAME_ID, - App::Instance()->node_id, - GAME_ID - }); - routing_tables_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/routing_tables.json", - { - GAME_ID - }); -#else - wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json", - {GAME_ID, GAME_ID}); - masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json", - {GAME_ID, GAME_ID}); - targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json", - {GAME_ID, GAME_ID}); -#endif + if (!f8::IsOnlineEnv()) { + if (f8::IsTestEnv()) { + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/wsproxy.test", + { + GAME_ID, + App::Instance()->instance_id, + GAME_ID + }); + } else { + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/wsproxy.dev", + { + GAME_ID, + App::Instance()->instance_id, + GAME_ID + }); + } } + + std::string wsproxyserver_cluster_json_file; +#if MASTER_MODE + std::string masterserver_cluster_json_file; + std::string routing_tables_json_file; + wsproxyserver_cluster_json_file = a8::Format("%s/node%d/game%d.wsproxy.cluster.json", + { + work_path_, + GAME_ID, + App::Instance()->node_id, + GAME_ID + }); + masterserver_cluster_json_file = a8::Format("%s/node%d/game%d.masterserver.cluster.json", + { + work_path_, + GAME_ID, + App::Instance()->node_id, + GAME_ID + }); + routing_tables_json_file = a8::Format("%s/routing_tables.json", + { + GAME_ID + }); +#else + std::string targetserver_cluster_json_file; + wsproxyserver_cluster_json_file = a8::Format("%s/game%d.wsproxy.cluster.json", + { + GAME_ID + }); + targetserver_cluster_json_file = a8::Format("%s/game%d.gameserver.cluster.json", + { + GAME_ID + }); +#endif + wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file); #if MASTER_MODE masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file); diff --git a/server/wsproxy/jsondatamgr.h b/server/wsproxy/jsondatamgr.h index b1fff4d..3312c74 100644 --- a/server/wsproxy/jsondatamgr.h +++ b/server/wsproxy/jsondatamgr.h @@ -19,6 +19,7 @@ class JsonDataMgr : public a8::Singleton #endif private: + std::string work_path_ = "../config"; a8::XObject wsproxyserver_cluster_json_; a8::XObject masterserver_cluster_json_; #if MASTER_MODE