This commit is contained in:
azw 2023-11-13 07:00:11 +00:00
parent 8a4e5ddc75
commit 7e4af7f435
2 changed files with 3 additions and 4 deletions

View File

@ -118,7 +118,7 @@ static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
void GCListener::Init()
{
tcp_listener_ = new a8::TcpListener();
tcp_listener_ = std::make_shared<a8::TcpListener>();
tcp_listener_->RegisterSessionClass<GCClientSession>();
tcp_listener_->on_error = GSListeneron_error;
@ -147,7 +147,6 @@ void GCListener::Init()
void GCListener::UnInit()
{
delete tcp_listener_;
tcp_listener_ = nullptr;
}

View File

@ -29,7 +29,7 @@ class GCListener : public a8::Singleton<GCListener>
template <typename T>
void SendMsgEx(unsigned short socket_handle, int msgid, T& msg)
{
f8::Net_SendMsg(tcp_listener_, socket_handle, 0, msgid, msg);
f8::Net_SendMsg(tcp_listener_.get(), socket_handle, 0, msgid, msg);
}
void SendBuf(unsigned short sockhandle, char* buf, int buflen);
@ -43,6 +43,6 @@ class GCListener : public a8::Singleton<GCListener>
int GetSocketCount();
private:
a8::TcpListener *tcp_listener_ = nullptr;
std::shared_ptr<a8::TcpListener> tcp_listener_;
std::map<int, std::tuple<std::string, std::string>> websocket_url_hash_;
};