rename GGListener -> WSListener
This commit is contained in:
parent
f8d0ec025e
commit
0cd8e560ed
@ -7,7 +7,7 @@
|
||||
#include "framework/cpp/netmsghandler.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "GGListener.h"
|
||||
#include "WSListener.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "handlermgr.h"
|
||||
|
||||
@ -78,10 +78,10 @@ static void CreateGameClientSocket(a8::TcpSession **p)
|
||||
|
||||
static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
|
||||
{
|
||||
a8::UdpLog::Instance()->Debug("GGListeneron_error %d %d", {type, errorid});
|
||||
a8::UdpLog::Instance()->Debug("WSListeneron_error %d %d", {type, errorid});
|
||||
}
|
||||
|
||||
void GGListener::Init()
|
||||
void WSListener::Init()
|
||||
{
|
||||
tcp_listener_ = new a8::TcpListener();
|
||||
tcp_listener_->on_create_client_socket = CreateGameClientSocket;
|
||||
@ -92,28 +92,28 @@ void GGListener::Init()
|
||||
tcp_listener_->Open();
|
||||
}
|
||||
|
||||
void GGListener::UnInit()
|
||||
void WSListener::UnInit()
|
||||
{
|
||||
delete tcp_listener_;
|
||||
tcp_listener_ = nullptr;
|
||||
}
|
||||
|
||||
void GGListener::SendText(int sockhandle, const std::string& text)
|
||||
void WSListener::SendText(int sockhandle, const std::string& text)
|
||||
{
|
||||
tcp_listener_->SendClientMsg(sockhandle, text.data(), text.size());
|
||||
}
|
||||
|
||||
void GGListener::ForceCloseClient(int sockhandle)
|
||||
void WSListener::ForceCloseClient(int sockhandle)
|
||||
{
|
||||
tcp_listener_->ForceCloseClient(sockhandle);
|
||||
}
|
||||
|
||||
void GGListener::MarkClient(int sockhandle, bool is_active)
|
||||
void WSListener::MarkClient(int sockhandle, bool is_active)
|
||||
{
|
||||
tcp_listener_->MarkClient(sockhandle, is_active);
|
||||
}
|
||||
|
||||
void GGListener::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
||||
void WSListener::_SS_Ping(f8::MsgHdr& hdr, const ss::SS_Ping& msg)
|
||||
{
|
||||
ss::SS_Pong pongmsg;
|
||||
SendMsg(hdr.socket_handle, pongmsg);
|
@ -13,14 +13,14 @@ namespace ss
|
||||
class SS_Ping;
|
||||
}
|
||||
|
||||
class GGListener : public a8::Singleton<GGListener>
|
||||
class WSListener : public a8::Singleton<WSListener>
|
||||
{
|
||||
public:
|
||||
enum { HID = HID_GGListener };
|
||||
enum { HID = HID_WSListener };
|
||||
|
||||
private:
|
||||
GGListener() {};
|
||||
friend class a8::Singleton<GGListener>;
|
||||
WSListener() {};
|
||||
friend class a8::Singleton<WSListener>;
|
||||
|
||||
public:
|
||||
void Init();
|
@ -17,7 +17,7 @@
|
||||
#include "handlermgr.h"
|
||||
#include "svrmgr.h"
|
||||
#include "imsmgr.h"
|
||||
#include "GGListener.h"
|
||||
#include "WSListener.h"
|
||||
#include "IMListener.h"
|
||||
#include "cachemgr.h"
|
||||
#include "perfmonitor.h"
|
||||
@ -82,7 +82,7 @@ void App::Init(int argc, char* argv[])
|
||||
f8::TGLog::Instance()->Init(a8::Format(PROJ_NAME_FMT, {}), false);
|
||||
JsonDataMgr::Instance()->Init();
|
||||
uuid.SetMachineId(instance_id);
|
||||
GGListener::Instance()->Init();
|
||||
WSListener::Instance()->Init();
|
||||
IMListener::Instance()->Init();
|
||||
SvrMgr::Instance()->Init();
|
||||
IMSMgr::Instance()->Init();
|
||||
@ -100,7 +100,7 @@ void App::UnInit()
|
||||
IMSMgr::Instance()->UnInit();
|
||||
SvrMgr::Instance()->UnInit();
|
||||
IMListener::Instance()->UnInit();
|
||||
GGListener::Instance()->UnInit();
|
||||
WSListener::Instance()->UnInit();
|
||||
JsonDataMgr::Instance()->UnInit();
|
||||
f8::MsgQueue::Instance()->UnInit();
|
||||
PerfMonitor::Instance()->UnInit();
|
||||
|
@ -20,7 +20,7 @@ enum NetHandler_e
|
||||
HID_SvrMgr,
|
||||
HID_IMSMgr,
|
||||
HID_CacheMgr,
|
||||
HID_GGListener
|
||||
HID_WSListener
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "friend_masterserver";
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "handlermgr.h"
|
||||
|
||||
#include "GGListener.h"
|
||||
#include "WSListener.h"
|
||||
#include "app.h"
|
||||
#include "svrmgr.h"
|
||||
#include "imsmgr.h"
|
||||
@ -46,7 +46,7 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
||||
{
|
||||
RegisterNetMsgHandler(&ggmsghandler, &SvrMgr::_SS_WSP_RequestTargetServer);
|
||||
|
||||
RegisterNetMsgHandler(&ggmsghandler, &GGListener::_SS_Ping);
|
||||
RegisterNetMsgHandler(&ggmsghandler, &WSListener::_SS_Ping);
|
||||
|
||||
RegisterNetMsgHandler(&immsghandler, &IMSMgr::_SS_Ping);
|
||||
RegisterNetMsgHandler(&immsghandler, &SvrMgr::_SS_IM_ReportServerInfo);
|
||||
@ -60,7 +60,7 @@ void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||
const std::string& url, const std::string& querystr)
|
||||
{
|
||||
if (url != "/webapp/index.php") {
|
||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse(404, ""));
|
||||
WSListener::Instance()->SendText(sockhandle, a8::HttpResponse(404, ""));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -82,12 +82,12 @@ void HandlerMgr::ProcGMMsg(unsigned long saddr, int sockhandle,
|
||||
if (!request->pending){
|
||||
std::string response;
|
||||
request->resp_xobj->ToJsonStr(response);
|
||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse(response));
|
||||
WSListener::Instance()->SendText(sockhandle, a8::HttpResponse(response));
|
||||
|
||||
delete request;
|
||||
}
|
||||
} else {
|
||||
GGListener::Instance()->SendText(sockhandle, a8::HttpResponse("{}"));
|
||||
WSListener::Instance()->SendText(sockhandle, a8::HttpResponse("{}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "svrmgr.h"
|
||||
#include "app.h"
|
||||
#include "GGListener.h"
|
||||
#include "WSListener.h"
|
||||
#include "IMListener.h"
|
||||
#include "cachemgr.h"
|
||||
|
||||
@ -40,7 +40,7 @@ void SvrMgr::_SS_WSP_RequestTargetServer(f8::MsgHdr& hdr, const ss::SS_WSP_Reque
|
||||
respmsg.set_error_code(1);
|
||||
respmsg.set_error_msg("无法分配节点");
|
||||
}
|
||||
GGListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
|
||||
WSListener::Instance()->SendMsg(hdr.socket_handle, respmsg);
|
||||
}
|
||||
|
||||
void SvrMgr::_SS_IM_ReportServerInfo(f8::MsgHdr& hdr, const ss::SS_IM_ReportServerInfo& msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user