1
This commit is contained in:
parent
59d0a88a60
commit
19fd619f28
12
f8/app.cc
12
f8/app.cc
@ -14,11 +14,17 @@
|
|||||||
#include <f8/msgqueue.h>
|
#include <f8/msgqueue.h>
|
||||||
#include <f8/timer.h>
|
#include <f8/timer.h>
|
||||||
#include <f8/protoutils.h>
|
#include <f8/protoutils.h>
|
||||||
|
#include <f8/tglog.h>
|
||||||
|
#include <f8/httpclientpool.h>
|
||||||
|
|
||||||
static const int MAX_ZONE_ID = 100;
|
static const int MAX_ZONE_ID = 100;
|
||||||
static const int MAX_NODE_ID = 8;
|
static const int MAX_NODE_ID = 8;
|
||||||
static const int MAX_INSTANCE_ID = 500;
|
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_ROOT_FMT = "/data/logs/%s";
|
||||||
static const char* const PROJ_LOG_ROOT_FMT = "/data/logs/%s/logs";
|
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";
|
static const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
|
||||||
@ -44,6 +50,8 @@ namespace f8
|
|||||||
InitLog();
|
InitLog();
|
||||||
f8::MsgQueue::Instance()->Init();
|
f8::MsgQueue::Instance()->Init();
|
||||||
f8::Timer::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();
|
user_app_->Init();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -51,6 +59,8 @@ namespace f8
|
|||||||
void App::UnInit()
|
void App::UnInit()
|
||||||
{
|
{
|
||||||
user_app_->UnInit();
|
user_app_->UnInit();
|
||||||
|
f8::TGLog::Instance()->UnInit();
|
||||||
|
f8::HttpClientPool::Instance()->UnInit();
|
||||||
f8::Timer::Instance()->UnInit();
|
f8::Timer::Instance()->UnInit();
|
||||||
f8::MsgQueue::Instance()->UnInit();
|
f8::MsgQueue::Instance()->UnInit();
|
||||||
UnInitLog();
|
UnInitLog();
|
||||||
@ -71,7 +81,7 @@ namespace f8
|
|||||||
f8::Timer::Instance()->Update();
|
f8::Timer::Instance()->Update();
|
||||||
f8::MsgQueue::Instance()->Update();
|
f8::MsgQueue::Instance()->Update();
|
||||||
DispatchNetMsg();
|
DispatchNetMsg();
|
||||||
user_app->Update();
|
user_app->Update(0);
|
||||||
Schedule();
|
Schedule();
|
||||||
}
|
}
|
||||||
UnInit();
|
UnInit();
|
||||||
|
2
f8/app.h
2
f8/app.h
@ -22,7 +22,7 @@ namespace f8
|
|||||||
virtual const std::string GetPkgName() = 0;
|
virtual const std::string GetPkgName() = 0;
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void UnInit() = 0;
|
virtual void UnInit() = 0;
|
||||||
virtual void Update() = 0;
|
virtual void Update(int delta_time) = 0;
|
||||||
virtual bool HasTask() = 0;
|
virtual bool HasTask() = 0;
|
||||||
virtual void DispatchSocketMsg(MsgHdr* hdr) = 0;
|
virtual void DispatchSocketMsg(MsgHdr* hdr) = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user