1
This commit is contained in:
parent
ffa73e12ff
commit
76eb32c357
@ -14,6 +14,7 @@
|
|||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
#include "ss_proto.pb.h"
|
#include "ss_proto.pb.h"
|
||||||
#include "handlermgr.h"
|
#include "handlermgr.h"
|
||||||
|
#include "ikcp.h"
|
||||||
|
|
||||||
class GCClientSession: public a8::WebSocketSession
|
class GCClientSession: public a8::WebSocketSession
|
||||||
{
|
{
|
||||||
@ -122,11 +123,21 @@ static void GSListeneron_error(a8::TcpListener*, int type, int errorid)
|
|||||||
f8::UdpLog::Instance()->Debug("GCListeneron_error %d %d", {type, errorid});
|
f8::UdpLog::Instance()->Debug("GCListeneron_error %d %d", {type, errorid});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class KcpSession
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
ikcpcb* kcp_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
static void GSUdpListeneron_error(a8::UdpListener*, int errorid)
|
static void GSUdpListeneron_error(a8::UdpListener*, int errorid)
|
||||||
{
|
{
|
||||||
f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid});
|
f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GSUdpListeneron_recv_packet(a8::UdpListener*, a8::UdpPacket* pkt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void GCListener::Init()
|
void GCListener::Init()
|
||||||
{
|
{
|
||||||
tcp_listener_ = new a8::TcpListener();
|
tcp_listener_ = new a8::TcpListener();
|
||||||
@ -139,6 +150,7 @@ void GCListener::Init()
|
|||||||
|
|
||||||
udp_listener_ = std::make_shared<a8::UdpListener>();
|
udp_listener_ = std::make_shared<a8::UdpListener>();
|
||||||
udp_listener_->on_error = GSUdpListeneron_error;
|
udp_listener_->on_error = GSUdpListeneron_error;
|
||||||
|
udp_listener_->on_recv_packet = GSUdpListeneron_recv_packet;
|
||||||
|
|
||||||
udp_listener_->bind_address = "0.0.0.0";
|
udp_listener_->bind_address = "0.0.0.0";
|
||||||
udp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_udp_port")->AsXValue();
|
udp_listener_->bind_port = JsonDataMgr::Instance()->GetConf()->At("listen_udp_port")->AsXValue();
|
||||||
|
@ -7,6 +7,7 @@ namespace a8
|
|||||||
class UdpListener;
|
class UdpListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class KcpSession;
|
||||||
class GCListener : public a8::Singleton<GCListener>
|
class GCListener : public a8::Singleton<GCListener>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -38,4 +39,5 @@ class GCListener : public a8::Singleton<GCListener>
|
|||||||
private:
|
private:
|
||||||
a8::TcpListener *tcp_listener_ = nullptr;
|
a8::TcpListener *tcp_listener_ = nullptr;
|
||||||
std::shared_ptr<a8::UdpListener> udp_listener_;
|
std::shared_ptr<a8::UdpListener> udp_listener_;
|
||||||
|
std::map<long long, std::shared_ptr<KcpSession>> kcp_session_hash_;
|
||||||
};
|
};
|
||||||
|
2
third_party/a8
vendored
2
third_party/a8
vendored
@ -1 +1 @@
|
|||||||
Subproject commit dd650c0bcab90d91a92d0a89b1b8fd7317cc971c
|
Subproject commit 0f16fe15137de458a690699e29beff23799a764f
|
Loading…
x
Reference in New Issue
Block a user