This commit is contained in:
aozhiwei 2019-06-03 15:24:58 +08:00
parent 7cca0db8d7
commit 286f3055ef
3 changed files with 13 additions and 8 deletions

View File

@ -19,7 +19,6 @@ set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_BUILD_TYPE "Release") #set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DA8_TCP_SESSION2=1")
include_directories( include_directories(
AFTER AFTER

View File

@ -23,7 +23,7 @@
#include "target_conn.h" #include "target_conn.h"
#include "target_conn_mgr.h" #include "target_conn_mgr.h"
#ifdef MASTER_MODE #if MASTER_MODE
#include "mastersvr.h" #include "mastersvr.h"
#include "mastersvrmgr.h" #include "mastersvrmgr.h"
#endif #endif
@ -87,7 +87,7 @@ bool App::Init(int argc, char* argv[])
if (!ParseOpt()) { if (!ParseOpt()) {
terminated = true; terminated = true;
#ifdef MASTER_MODE #if MASTER_MODE
if (node_id <= 0) { if (node_id <= 0) {
a8::XPrintf("gameserver启动失败,缺少-n参数\n", {}); a8::XPrintf("gameserver启动失败,缺少-n参数\n", {});
} else if (node_id > MAX_NODE_ID) { } else if (node_id > MAX_NODE_ID) {
@ -102,7 +102,13 @@ bool App::Init(int argc, char* argv[])
#endif #endif
return false; return false;
} }
a8::XPrintf("wsproxy starting instance_id:%d pid:%d\n", {instance_id, getpid()}); a8::XPrintf("wsproxy starting node_id:%d instance_id:%d pid:%d master_mode:%d\n",
{
node_id,
instance_id,
getpid(),
MASTER_MODE
});
loop_mutex_ = new std::mutex(); loop_mutex_ = new std::mutex();
loop_cond_ = new std::condition_variable(); loop_cond_ = new std::condition_variable();
@ -157,7 +163,7 @@ void App::UnInit()
{ {
a8::XPrintf("wsproxy terminating instance_id:%d pid:%d\n", {instance_id, getpid()}); a8::XPrintf("wsproxy terminating instance_id:%d pid:%d\n", {instance_id, getpid()});
GCListener::Instance()->UnInit(); GCListener::Instance()->UnInit();
#ifdef MASTER_MODE #if MASTER_MODE
MasterSvrMgr::Instance()->UnInit(); MasterSvrMgr::Instance()->UnInit();
#endif #endif
TargetConnMgr::Instance()->UnInit(); TargetConnMgr::Instance()->UnInit();
@ -459,7 +465,7 @@ void App::ProcessIMMsg()
case IM_ClientSocketDisconnect: case IM_ClientSocketDisconnect:
{ {
GameClientMgr::Instance()->OnClientDisconnect(pdelnode->params); GameClientMgr::Instance()->OnClientDisconnect(pdelnode->params);
#ifdef MASTER_MODE #if MASTER_MODE
MasterSvrMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender); MasterSvrMgr::Instance()->RemoveRequest(pdelnode->params.param1, pdelnode->params.sender);
#endif #endif
} }
@ -543,7 +549,7 @@ bool App::ParseOpt()
break; break;
} }
} }
#ifdef MASTER_MODE #if MASTER_MODE
return instance_id > 0 && node_id > 0; return instance_id > 0 && node_id > 0;
#else #else
return instance_id > 0; return instance_id > 0;

View File

@ -35,7 +35,7 @@ void JsonDataMgr::Init()
masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID}); masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID});
#endif #endif
} else { } else {
#ifdef MASTER_MODE #if MASTER_MODE
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.wsproxy.cluster.json", wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.wsproxy.cluster.json",
{ {
GAME_ID, GAME_ID,