From fd8708e1979a949232ed0df84fd335680f340270 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 30 May 2019 15:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0node=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/wsproxy/app.cc | 4 ++++ server/wsproxy/jsondatamgr.cc | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/server/wsproxy/app.cc b/server/wsproxy/app.cc index 41c2acb..4d0b410 100644 --- a/server/wsproxy/app.cc +++ b/server/wsproxy/app.cc @@ -115,7 +115,11 @@ bool App::Init(int argc, char* argv[]) a8::Timer::Instance()->Init(); JsonDataMgr::Instance()->Init(); GCListener::Instance()->Init(); +#if MASTER_MODE + uuid.SetMachineId((node_id - 1) * MAX_NODE_ID + instance_id); +#else uuid.SetMachineId(instance_id); +#endif GameClientMgr::Instance()->Init(); MasterSvrMgr::Instance()->Init(); TargetConnMgr::Instance()->Init(); diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index 54c0289..aea288a 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -9,16 +9,55 @@ void JsonDataMgr::Init() std::string masterserver_cluster_json_file; std::string targetserver_cluster_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 + }); + targetserver_cluster_json_file = a8::Format("../config/node%d/game%d.gameserver.cluster.json", + { + App::Instance()->node_id, + GAME_ID + }); +#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}); targetserver_cluster_json_file = a8::Format("../config/game%d.gameserver.cluster.json", {GAME_ID}); +#endif } else { +#ifdef 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 + }); + targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.gameserver.cluster.json", + { + GAME_ID, + App::Instance()->node_id, + 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 } wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file); #if MASTER_MODE