add MsgQueue
This commit is contained in:
parent
c9bf8a2215
commit
1865fa0ce7
@ -11,6 +11,8 @@
|
|||||||
#include <a8/uuid.h>
|
#include <a8/uuid.h>
|
||||||
|
|
||||||
#include "framework/cpp/netmsghandler.h"
|
#include "framework/cpp/netmsghandler.h"
|
||||||
|
#include "framework/cpp/msgqueue.h"
|
||||||
|
#include "framework/cpp/dbpool.h"
|
||||||
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "GSListener.h"
|
#include "GSListener.h"
|
||||||
@ -18,7 +20,6 @@
|
|||||||
#include "handlermgr.h"
|
#include "handlermgr.h"
|
||||||
#include "ss_msgid.pb.h"
|
#include "ss_msgid.pb.h"
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
#include "dbpool.h"
|
|
||||||
|
|
||||||
struct MsgNode
|
struct MsgNode
|
||||||
{
|
{
|
||||||
@ -86,8 +87,10 @@ void App::Init(int argc, char* argv[])
|
|||||||
InitLog();
|
InitLog();
|
||||||
HandlerMgr::Instance()->Init();
|
HandlerMgr::Instance()->Init();
|
||||||
a8::Timer::Instance()->Init();
|
a8::Timer::Instance()->Init();
|
||||||
|
f8::MsgQueue::Instance()->Init();
|
||||||
JsonDataMgr::Instance()->Init();
|
JsonDataMgr::Instance()->Init();
|
||||||
DBPool::Instance()->Init();
|
f8::DBPool::Instance()->Init();
|
||||||
|
f8::DBPool::Instance()->SetThreadNum(10);
|
||||||
GSListener::Instance()->Init();
|
GSListener::Instance()->Init();
|
||||||
uuid.SetMachineId(instance_id);
|
uuid.SetMachineId(instance_id);
|
||||||
|
|
||||||
@ -112,8 +115,9 @@ void App::UnInit()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GSListener::Instance()->UnInit();
|
GSListener::Instance()->UnInit();
|
||||||
DBPool::Instance()->UnInit();
|
f8::DBPool::Instance()->UnInit();
|
||||||
JsonDataMgr::Instance()->UnInit();
|
JsonDataMgr::Instance()->UnInit();
|
||||||
|
f8::MsgQueue::Instance()->UnInit();
|
||||||
a8::Timer::Instance()->UnInit();
|
a8::Timer::Instance()->UnInit();
|
||||||
HandlerMgr::Instance()->UnInit();
|
HandlerMgr::Instance()->UnInit();
|
||||||
UnInitLog();
|
UnInitLog();
|
||||||
@ -320,7 +324,7 @@ void App::ProcessGSMsg(f8::MsgHdr& hdr)
|
|||||||
break;
|
break;
|
||||||
case HID_DBPool:
|
case HID_DBPool:
|
||||||
{
|
{
|
||||||
ProcessNetMsg(handler, DBPool::Instance(), hdr);
|
// ProcessNetMsg(handler, DBPool::Instance(), hdr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -339,6 +343,15 @@ void App::ProcessIMMsg()
|
|||||||
while (im_work_node_) {
|
while (im_work_node_) {
|
||||||
IMMsgNode *pdelnode = im_work_node_;
|
IMMsgNode *pdelnode = im_work_node_;
|
||||||
switch (im_work_node_->msgid) {
|
switch (im_work_node_->msgid) {
|
||||||
|
case f8::IM_SysMsgQueue:
|
||||||
|
{
|
||||||
|
const a8::XParams* param = (const a8::XParams*)pdelnode->params.param1.GetUserData();
|
||||||
|
f8::MsgQueue::Instance()->ProcessMsg(pdelnode->params.sender.GetInt(),
|
||||||
|
*param
|
||||||
|
);
|
||||||
|
delete param;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IM_ExecGM:
|
case IM_ExecGM:
|
||||||
{
|
{
|
||||||
HandlerMgr::Instance()->ProcGMMsg(pdelnode->params.param3,
|
HandlerMgr::Instance()->ProcGMMsg(pdelnode->params.param3,
|
||||||
|
@ -28,7 +28,7 @@ void HandlerMgr::UnInit()
|
|||||||
void HandlerMgr::RegisterNetMsgHandlers()
|
void HandlerMgr::RegisterNetMsgHandlers()
|
||||||
{
|
{
|
||||||
RegisterNetMsgHandler(&gsmsghandler, &HandlerMgr::_SS_Ping);
|
RegisterNetMsgHandler(&gsmsghandler, &HandlerMgr::_SS_Ping);
|
||||||
RegisterNetMsgHandler(&gsmsghandler, &DBPool::_SS_GSM_ExecAsyncSql);
|
RegisterNetMsgHandler(&gsmsghandler, &HandlerMgr::_SS_GSM_ExecAsyncSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||||
@ -72,6 +72,11 @@ void HandlerMgr::RegisterGMMsgHandler(const std::string& msgname,
|
|||||||
gmhandlers_[msgname] = handler;
|
gmhandlers_[msgname] = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandlerMgr::_SS_GSM_ExecAsyncSql(f8::MsgHdr& hdr, const ss::SS_GSM_ExecAsyncSql& msg)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void HandlerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
void HandlerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
||||||
{
|
{
|
||||||
ss::SS_Pong pongmsg;
|
ss::SS_Pong pongmsg;
|
||||||
|
@ -12,6 +12,7 @@ namespace a8
|
|||||||
namespace ss
|
namespace ss
|
||||||
{
|
{
|
||||||
class SS_Ping;
|
class SS_Ping;
|
||||||
|
class SS_GSM_ExecAsyncSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HandlerMgr : public a8::Singleton<HandlerMgr>
|
class HandlerMgr : public a8::Singleton<HandlerMgr>
|
||||||
@ -35,6 +36,7 @@ class HandlerMgr : public a8::Singleton<HandlerMgr>
|
|||||||
const std::string& url, const std::string& quyerstr);
|
const std::string& url, const std::string& quyerstr);
|
||||||
|
|
||||||
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
|
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
|
||||||
|
void _SS_GSM_ExecAsyncSql(f8::MsgHdr& hdr, const ss::SS_GSM_ExecAsyncSql& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RegisterNetMsgHandlers();
|
void RegisterNetMsgHandlers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user