This commit is contained in:
aozhiwei 2019-01-16 15:53:47 +08:00
parent ff17f72494
commit 55ebb04c2f
7 changed files with 26 additions and 12 deletions

View File

@ -313,6 +313,11 @@ void App::ProcessGSMsg(f8::MsgHdr& hdr)
hdr.msgid);
if (handler) {
switch (handler->handlerid) {
case HID_HandlerMgr:
{
ProcessNetMsg(handler, HandlerMgr::Instance(), hdr);
}
break;
case HID_DBPool:
{
ProcessNetMsg(handler, DBPool::Instance(), hdr);

View File

@ -14,6 +14,7 @@ enum InnerMesssage_e
//网络处理对象
enum NetHandler_e
{
HID_HandlerMgr,
HID_GSListener,
HID_DBPool,
};

View File

@ -231,12 +231,6 @@ void DBPool::Update()
{
}
void DBPool::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
{
ss::SS_Pong respmsg;
GSListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
}
void DBPool::_SS_GSM_ExecAsyncSql(f8::MsgHdr& hdr, const ss::SS_GSM_ExecAsyncSql& msg)
{
#if 0

View File

@ -2,7 +2,6 @@
namespace ss
{
class SS_Ping;
class SS_GSM_ExecAsyncSql;
}
@ -21,8 +20,6 @@ class DBPool : public a8::Singleton<DBPool>
void UnInit();
void Update();
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:

View File

@ -27,7 +27,7 @@ void HandlerMgr::UnInit()
void HandlerMgr::RegisterNetMsgHandlers()
{
RegisterNetMsgHandler(&gsmsghandler, &DBPool::_SS_Ping);
RegisterNetMsgHandler(&gsmsghandler, &HandlerMgr::_SS_Ping);
RegisterNetMsgHandler(&gsmsghandler, &DBPool::_SS_GSM_ExecAsyncSql);
}
@ -71,3 +71,9 @@ void HandlerMgr::RegisterGMMsgHandler(const std::string& msgname,
{
gmhandlers_[msgname] = handler;
}
void HandlerMgr::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
{
ss::SS_Pong pongmsg;
GSListener::Instance()->SendMsg(hdr.socket_handle, pongmsg);
}

View File

@ -9,6 +9,11 @@ namespace a8
class MutableXObject;
}
namespace ss
{
class SS_Ping;
}
class HandlerMgr : public a8::Singleton<HandlerMgr>
{
@ -16,6 +21,9 @@ class HandlerMgr : public a8::Singleton<HandlerMgr>
HandlerMgr() {};
friend class a8::Singleton<HandlerMgr>;
public:
enum { HID = HID_HandlerMgr };
public:
void Init();
@ -26,6 +34,8 @@ class HandlerMgr : public a8::Singleton<HandlerMgr>
void ProcGMMsg(unsigned long saddr, int sockhandle,
const std::string& url, const std::string& quyerstr);
void _SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg);
private:
void RegisterNetMsgHandlers();
void RegisterGMMsgHandler(const std::string& msgname,

View File

@ -3,8 +3,9 @@ package ss;
//id定义
enum SSMessageId_e
{
_SS_Ping = 100;
_SS_Pong = 101;
_SS_Ping = 150;
_SS_Pong = 151;
_SS_GSM_ExecAsyncSql = 152;
_SS_DPM_ExecAsyncSql = 153;
}