This commit is contained in:
aozhiwei 2023-11-24 14:25:08 +08:00
parent 59d0a88a60
commit 19fd619f28
2 changed files with 12 additions and 2 deletions

View File

@ -14,11 +14,17 @@
#include <f8/msgqueue.h>
#include <f8/timer.h>
#include <f8/protoutils.h>
#include <f8/tglog.h>
#include <f8/httpclientpool.h>
static const int MAX_ZONE_ID = 100;
static const int MAX_NODE_ID = 8;
static const int MAX_INSTANCE_ID = 500;
static const int MAX_SYS_HTTP_NUM = 2;
static const int MAX_USER_HTTP_NUM = 8;
static const int MAX_ALL_HTTP_NUM = MAX_SYS_HTTP_NUM + MAX_USER_HTTP_NUM;
static const char* const PROJ_ROOT_FMT = "/data/logs/%s";
static const char* const PROJ_LOG_ROOT_FMT = "/data/logs/%s/logs";
static const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
@ -44,6 +50,8 @@ namespace f8
InitLog();
f8::MsgQueue::Instance()->Init();
f8::Timer::Instance()->Init();
f8::TGLog::Instance()->Init(user_app_->GetPkgName(), false, 0);
f8::HttpClientPool::Instance()->Init(MAX_ALL_HTTP_NUM, MAX_SYS_HTTP_NUM, MAX_USER_HTTP_NUM);
user_app_->Init();
return true;
}
@ -51,6 +59,8 @@ namespace f8
void App::UnInit()
{
user_app_->UnInit();
f8::TGLog::Instance()->UnInit();
f8::HttpClientPool::Instance()->UnInit();
f8::Timer::Instance()->UnInit();
f8::MsgQueue::Instance()->UnInit();
UnInitLog();
@ -71,7 +81,7 @@ namespace f8
f8::Timer::Instance()->Update();
f8::MsgQueue::Instance()->Update();
DispatchNetMsg();
user_app->Update();
user_app->Update(0);
Schedule();
}
UnInit();

View File

@ -22,7 +22,7 @@ namespace f8
virtual const std::string GetPkgName() = 0;
virtual void Init() = 0;
virtual void UnInit() = 0;
virtual void Update() = 0;
virtual void Update(int delta_time) = 0;
virtual bool HasTask() = 0;
virtual void DispatchSocketMsg(MsgHdr* hdr) = 0;
};