1
This commit is contained in:
parent
8a4e5ddc75
commit
7e4af7f435
@ -118,7 +118,7 @@ static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
|
|||||||
|
|
||||||
void GCListener::Init()
|
void GCListener::Init()
|
||||||
{
|
{
|
||||||
tcp_listener_ = new a8::TcpListener();
|
tcp_listener_ = std::make_shared<a8::TcpListener>();
|
||||||
tcp_listener_->RegisterSessionClass<GCClientSession>();
|
tcp_listener_->RegisterSessionClass<GCClientSession>();
|
||||||
tcp_listener_->on_error = GSListeneron_error;
|
tcp_listener_->on_error = GSListeneron_error;
|
||||||
|
|
||||||
@ -147,7 +147,6 @@ void GCListener::Init()
|
|||||||
|
|
||||||
void GCListener::UnInit()
|
void GCListener::UnInit()
|
||||||
{
|
{
|
||||||
delete tcp_listener_;
|
|
||||||
tcp_listener_ = nullptr;
|
tcp_listener_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class GCListener : public a8::Singleton<GCListener>
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void SendMsgEx(unsigned short socket_handle, int msgid, T& msg)
|
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);
|
void SendBuf(unsigned short sockhandle, char* buf, int buflen);
|
||||||
@ -43,6 +43,6 @@ class GCListener : public a8::Singleton<GCListener>
|
|||||||
int GetSocketCount();
|
int GetSocketCount();
|
||||||
|
|
||||||
private:
|
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_;
|
std::map<int, std::tuple<std::string, std::string>> websocket_url_hash_;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user