diff --git a/server/dbproxy/app.cc b/server/dbproxy/app.cc index 20d38c1..ed9ebae 100644 --- a/server/dbproxy/app.cc +++ b/server/dbproxy/app.cc @@ -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); diff --git a/server/dbproxy/constant.h b/server/dbproxy/constant.h index ff6ee47..c30667c 100644 --- a/server/dbproxy/constant.h +++ b/server/dbproxy/constant.h @@ -14,6 +14,7 @@ enum InnerMesssage_e //网络处理对象 enum NetHandler_e { + HID_HandlerMgr, HID_GSListener, HID_DBPool, }; diff --git a/server/dbproxy/dbpool.cc b/server/dbproxy/dbpool.cc index 7970f63..7d59064 100644 --- a/server/dbproxy/dbpool.cc +++ b/server/dbproxy/dbpool.cc @@ -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 diff --git a/server/dbproxy/dbpool.h b/server/dbproxy/dbpool.h index d0d82b8..5edc6a8 100644 --- a/server/dbproxy/dbpool.h +++ b/server/dbproxy/dbpool.h @@ -2,7 +2,6 @@ namespace ss { - class SS_Ping; class SS_GSM_ExecAsyncSql; } @@ -21,8 +20,6 @@ class DBPool : public a8::Singleton 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: diff --git a/server/dbproxy/handlermgr.cc b/server/dbproxy/handlermgr.cc index 17ee14c..4f60b68 100644 --- a/server/dbproxy/handlermgr.cc +++ b/server/dbproxy/handlermgr.cc @@ -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); +} diff --git a/server/dbproxy/handlermgr.h b/server/dbproxy/handlermgr.h index 6a13a79..7e7c8ca 100644 --- a/server/dbproxy/handlermgr.h +++ b/server/dbproxy/handlermgr.h @@ -9,6 +9,11 @@ namespace a8 class MutableXObject; } +namespace ss +{ + class SS_Ping; +} + class HandlerMgr : public a8::Singleton { @@ -16,6 +21,9 @@ class HandlerMgr : public a8::Singleton HandlerMgr() {}; friend class a8::Singleton; + public: + enum { HID = HID_HandlerMgr }; + public: void Init(); @@ -26,6 +34,8 @@ class HandlerMgr : public a8::Singleton 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, diff --git a/server/tools/protobuild/ss_msgid.proto b/server/tools/protobuild/ss_msgid.proto index 03d529b..df9ed8b 100644 --- a/server/tools/protobuild/ss_msgid.proto +++ b/server/tools/protobuild/ss_msgid.proto @@ -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; }