From 19fd619f2892d1374734e37fe3e8b5aee2dd3e19 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 24 Nov 2023 14:25:08 +0800 Subject: [PATCH] 1 --- f8/app.cc | 12 +++++++++++- f8/app.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/f8/app.cc b/f8/app.cc index b8b5b54..c19c7ab 100644 --- a/f8/app.cc +++ b/f8/app.cc @@ -14,11 +14,17 @@ #include #include #include +#include +#include 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(); diff --git a/f8/app.h b/f8/app.h index a00896f..d6fd304 100644 --- a/f8/app.h +++ b/f8/app.h @@ -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; };