1
This commit is contained in:
parent
f0109274ca
commit
cca15c0772
@ -32,10 +32,7 @@
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
#include "f8/msgqueue.h"
|
||||
#include "f8/tglog.h"
|
||||
#include "f8/httpclientpool.h"
|
||||
#include "f8/btmgr.h"
|
||||
#include <f8/btmgr.h>
|
||||
#include <f8/timer.h>
|
||||
|
||||
#include "tracemgr.h"
|
||||
@ -48,21 +45,6 @@
|
||||
#include "mt/MetaMgr.h"
|
||||
#include "mt/Skill.h"
|
||||
|
||||
struct MsgNode
|
||||
{
|
||||
SocketFrom_e sockfrom;
|
||||
int sockhandle;
|
||||
unsigned short msgid;
|
||||
unsigned int seqid;
|
||||
long ip_saddr;
|
||||
char* buf;
|
||||
int buflen;
|
||||
MsgNode* next;
|
||||
};
|
||||
|
||||
const char* const PROJ_LOG_ROOT_FMT = "/data/logs/%s/logs";
|
||||
const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
|
||||
|
||||
static void SavePerfLog()
|
||||
{
|
||||
f8::UdpLog::Instance()->Info
|
||||
@ -125,57 +107,12 @@ static void SavePerfLog()
|
||||
|
||||
void App::Init()
|
||||
{
|
||||
#if 0
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
this->argc_ = argc;
|
||||
this->argv_ = argv;
|
||||
|
||||
if (!ParseOpt()) {
|
||||
if (zone_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-z参数\n", {});
|
||||
} else if (zone_id_ > MAX_ZONE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-z参数不能大于%d\n", {MAX_ZONE_ID});
|
||||
} else if (node_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-n参数\n", {});
|
||||
} else if (node_id_ > MAX_NODE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-n参数不能大于%d\n", {MAX_NODE_ID});
|
||||
} else if (instance_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-i参数\n", {});
|
||||
} else if (instance_id_ > MAX_INSTANCE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-i参数不能大于%d\n", {MAX_INSTANCE_ID});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int debug_mode = 0;
|
||||
#ifdef MYDEBUG
|
||||
debug_mode = 1;
|
||||
#endif
|
||||
a8::XPrintf("gameserver starting zone_id:%d node_id:%d instance_id:%d pid:%d game_id:%d debug_mode:%d\n",
|
||||
{
|
||||
zone_id_,
|
||||
node_id_,
|
||||
instance_id_,
|
||||
getpid(),
|
||||
GAME_ID,
|
||||
debug_mode
|
||||
});
|
||||
|
||||
loop_mutex_ = std::make_shared<std::mutex>();
|
||||
loop_cond_ = std::make_shared<std::condition_variable>();
|
||||
msg_mutex_ = std::make_shared<std::mutex>();
|
||||
|
||||
srand(time(nullptr));
|
||||
InitLog();
|
||||
#ifdef MYDEBUG
|
||||
TraceMgr::Instance()->Init("gameserver2006");
|
||||
#endif
|
||||
PerfMonitor::Instance()->Init();
|
||||
f8::MsgQueue::Instance()->Init();
|
||||
HandlerMgr::Instance()->Init();
|
||||
f8::Timer::Instance()->Init();
|
||||
Perf::Instance()->Init();
|
||||
f8::TGLog::Instance()->Init(a8::Format(PROJ_NAME_FMT, {GAME_ID}), false, 0);
|
||||
f8::HttpClientPool::Instance()->Init(MAX_ALL_HTTP_NUM, MAX_SYS_HTTP_NUM, MAX_USER_HTTP_NUM);
|
||||
f8::BtMgr::Instance()->Init("exported");
|
||||
#ifdef MYDEBUG1
|
||||
f8::BtMgr::Instance()->SetLogging(true);
|
||||
@ -186,7 +123,6 @@ void App::Init()
|
||||
mt::MetaMgr::Instance()->Init();
|
||||
SelfChecker::Init();
|
||||
EntityFactory::Instance()->Init();
|
||||
uuid_.SetMachineId((node_id_ - 1) * MAX_NODE_ID + instance_id_);
|
||||
KillMgr::Instance()->Init();
|
||||
RoomMgr::Instance()->Init();
|
||||
MatchMgr::Instance()->Init();
|
||||
@ -194,16 +130,6 @@ void App::Init()
|
||||
PlayerMgr::Instance()->Init();
|
||||
GGListener::Instance()->Init();
|
||||
HttpProxy::Instance()->Init();
|
||||
|
||||
f8::UdpLog::Instance()->Info("gameserver starting zone_id:%d node_id:%d instance_id:%d pid:%d debug_mode:%d channel:%d",
|
||||
{
|
||||
zone_id_,
|
||||
node_id_,
|
||||
instance_id_,
|
||||
getpid(),
|
||||
debug_mode,
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
{
|
||||
int perf_log_time = 1000 * 30;
|
||||
f8::Timer::Instance()->SetInterval
|
||||
@ -215,13 +141,10 @@ void App::Init()
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::UnInit()
|
||||
{
|
||||
//const char* s2 = GetEnumString<int>();
|
||||
//int i = static_cast<int>(Test_e::kFlyBuffId);
|
||||
PlayerMgr::Instance()->UnInit();
|
||||
RoomMgr::Instance()->UnInit();
|
||||
HttpProxy::Instance()->UnInit();
|
||||
@ -235,41 +158,14 @@ void App::UnInit()
|
||||
LispEnv::Instance()->UnInit();
|
||||
JsonDataMgr::Instance()->UnInit();
|
||||
f8::BtMgr::Instance()->UnInit();
|
||||
f8::HttpClientPool::Instance()->UnInit();
|
||||
HandlerMgr::Instance()->UnInit();
|
||||
f8::MsgQueue::Instance()->UnInit();
|
||||
f8::Timer::Instance()->UnInit();
|
||||
PerfMonitor::Instance()->UnInit();
|
||||
Perf::Instance()->UnInit();
|
||||
f8::TGLog::Instance()->UnInit();
|
||||
#ifdef MYDEBUG
|
||||
TraceMgr::Instance()->UnInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
int App::Run()
|
||||
{
|
||||
int ret = 0;
|
||||
f8::UdpLog::Instance()->Info("gameserver running", {});
|
||||
last_run_tick_ = a8::XGetTickCount();
|
||||
int delta_time = 0;
|
||||
while (!terminated_) {
|
||||
a8::tick_t begin_tick = a8::XGetTickCount();
|
||||
Global::g_nowtime = time(nullptr);
|
||||
QuickExecute(delta_time);
|
||||
SlowerExecute(delta_time);
|
||||
Schedule();
|
||||
a8::tick_t end_tick = a8::XGetTickCount();
|
||||
if (end_tick - begin_tick > PerfMonitor::Instance()->max_run_delay_time) {
|
||||
PerfMonitor::Instance()->max_run_delay_time = end_tick - begin_tick;
|
||||
}
|
||||
delta_time = end_tick - begin_tick;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool App::HasTask()
|
||||
{
|
||||
return RoomMgr::Instance()->RoomNum() > 0;
|
||||
|
2
third_party/f8
vendored
2
third_party/f8
vendored
@ -1 +1 @@
|
||||
Subproject commit 59d0a88a602354c0fccf1b72b43d2d78f2fe4d10
|
||||
Subproject commit 19fd619f2892d1374734e37fe3e8b5aee2dd3e19
|
Loading…
x
Reference in New Issue
Block a user