1
This commit is contained in:
parent
4c8d3488f4
commit
78ccad1206
@ -85,7 +85,7 @@ static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
|
|||||||
|
|
||||||
void GGListener::Init()
|
void GGListener::Init()
|
||||||
{
|
{
|
||||||
tcp_listener_ = new a8::TcpListener();
|
tcp_listener_ = std::make_shared<a8::TcpListener>();
|
||||||
tcp_listener_->on_create_client_socket = CreateGameClientSocket;
|
tcp_listener_->on_create_client_socket = CreateGameClientSocket;
|
||||||
tcp_listener_->on_error = GSListeneron_error;
|
tcp_listener_->on_error = GSListeneron_error;
|
||||||
|
|
||||||
@ -96,8 +96,6 @@ void GGListener::Init()
|
|||||||
|
|
||||||
void GGListener::UnInit()
|
void GGListener::UnInit()
|
||||||
{
|
{
|
||||||
delete tcp_listener_;
|
|
||||||
tcp_listener_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GGListener::SendText(int sockhandle, const std::string& text)
|
void GGListener::SendText(int sockhandle, const std::string& text)
|
||||||
|
@ -22,7 +22,7 @@ class GGListener : public a8::Singleton<GGListener>
|
|||||||
void SendMsg(int sockhandle, T& msg)
|
void SendMsg(int sockhandle, T& msg)
|
||||||
{
|
{
|
||||||
static int msgid = f8::Net_GetMessageId(msg);
|
static int msgid = f8::Net_GetMessageId(msg);
|
||||||
f8::Net_SendMsg(tcp_listener_, sockhandle, 0, msgid, msg);
|
f8::Net_SendMsg(tcp_listener_.get(), sockhandle, 0, msgid, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendText(int sockhandle, const std::string& text);
|
void SendText(int sockhandle, const std::string& text);
|
||||||
@ -31,5 +31,5 @@ class GGListener : public a8::Singleton<GGListener>
|
|||||||
void MarkClient(int sockhandle, bool is_active);
|
void MarkClient(int sockhandle, bool is_active);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
a8::TcpListener *tcp_listener_ = nullptr;
|
std::shared_ptr<a8::TcpListener> tcp_listener_;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ const std::string App::GetPkgName()
|
|||||||
|
|
||||||
void App::Init()
|
void App::Init()
|
||||||
{
|
{
|
||||||
msg_mutex_ = new std::mutex();
|
msg_mutex_ = std::make_shared<std::mutex>();
|
||||||
|
|
||||||
HandlerMgr::Instance()->Init();
|
HandlerMgr::Instance()->Init();
|
||||||
JsonDataMgr::Instance()->Init();
|
JsonDataMgr::Instance()->Init();
|
||||||
@ -80,9 +80,6 @@ void App::UnInit()
|
|||||||
GGListener::Instance()->UnInit();
|
GGListener::Instance()->UnInit();
|
||||||
JsonDataMgr::Instance()->UnInit();
|
JsonDataMgr::Instance()->UnInit();
|
||||||
HandlerMgr::Instance()->UnInit();
|
HandlerMgr::Instance()->UnInit();
|
||||||
|
|
||||||
delete msg_mutex_;
|
|
||||||
msg_mutex_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::Update()
|
void App::Update()
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::mutex *msg_mutex_ = nullptr;
|
std::shared_ptr<std::mutex> msg_mutex_;
|
||||||
MsgNode* top_node_ = nullptr;
|
MsgNode* top_node_ = nullptr;
|
||||||
MsgNode* bot_node_ = nullptr;
|
MsgNode* bot_node_ = nullptr;
|
||||||
MsgNode* work_node_ = nullptr;
|
MsgNode* work_node_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user