1
This commit is contained in:
parent
fa23c74298
commit
ffa73e12ff
@ -3,6 +3,7 @@
|
||||
#include <google/protobuf/message.h>
|
||||
#include <a8/websocketsession.h>
|
||||
#include <a8/tcplistener.h>
|
||||
#include <a8/udplistener.h>
|
||||
|
||||
#include <f8/netmsghandler.h>
|
||||
#include <f8/udplog.h>
|
||||
@ -121,6 +122,11 @@ static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
|
||||
f8::UdpLog::Instance()->Debug("GCListeneron_error %d %d", {type, errorid});
|
||||
}
|
||||
|
||||
static void GSUdpListeneron_error(a8::UdpListener*, int errorid)
|
||||
{
|
||||
f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid});
|
||||
}
|
||||
|
||||
void GCListener::Init()
|
||||
{
|
||||
tcp_listener_ = new a8::TcpListener();
|
||||
@ -130,6 +136,13 @@ void GCListener::Init()
|
||||
tcp_listener_->bind_address = "0.0.0.0";
|
||||
tcp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_port")->AsXValue();
|
||||
tcp_listener_->Open();
|
||||
|
||||
udp_listener_ = std::make_shared<a8::UdpListener>();
|
||||
udp_listener_->on_error = GSUdpListeneron_error;
|
||||
|
||||
udp_listener_->bind_address = "0.0.0.0";
|
||||
udp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_udp_port")->AsXValue();
|
||||
udp_listener_->Open();
|
||||
}
|
||||
|
||||
void GCListener::UnInit()
|
||||
|
@ -37,5 +37,5 @@ class GCListener : public a8::Singleton<GCListener>
|
||||
|
||||
private:
|
||||
a8::TcpListener *tcp_listener_ = nullptr;
|
||||
a8::UdpListener *udp_listener_ = nullptr;
|
||||
std::shared_ptr<a8::UdpListener> udp_listener_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user