From 76eb32c357685348463ee22ae6cf6d9c35276aa3 Mon Sep 17 00:00:00 2001 From: azw Date: Sat, 15 Apr 2023 08:38:03 +0000 Subject: [PATCH] 1 --- server/wsproxy/GCListener.cc | 12 ++++++++++++ server/wsproxy/GCListener.h | 2 ++ third_party/a8 | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/wsproxy/GCListener.cc b/server/wsproxy/GCListener.cc index 6245b77..70b9a21 100644 --- a/server/wsproxy/GCListener.cc +++ b/server/wsproxy/GCListener.cc @@ -14,6 +14,7 @@ #include "jsondatamgr.h" #include "ss_proto.pb.h" #include "handlermgr.h" +#include "ikcp.h" 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}); } +class KcpSession +{ +private: + ikcpcb* kcp_ = nullptr; +}; + static void GSUdpListeneron_error(a8::UdpListener*, int errorid) { f8::UdpLog::Instance()->Debug("GCUdpListeneron_error %d", {errorid}); } +static void GSUdpListeneron_recv_packet(a8::UdpListener*, a8::UdpPacket* pkt) +{ +} + void GCListener::Init() { tcp_listener_ = new a8::TcpListener(); @@ -139,6 +150,7 @@ void GCListener::Init() udp_listener_ = std::make_shared(); 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_port = JsonDataMgr::Instance()->GetConf()->At("listen_udp_port")->AsXValue(); diff --git a/server/wsproxy/GCListener.h b/server/wsproxy/GCListener.h index e424ee3..f2aa64b 100644 --- a/server/wsproxy/GCListener.h +++ b/server/wsproxy/GCListener.h @@ -7,6 +7,7 @@ namespace a8 class UdpListener; } +class KcpSession; class GCListener : public a8::Singleton { private: @@ -38,4 +39,5 @@ class GCListener : public a8::Singleton private: a8::TcpListener *tcp_listener_ = nullptr; std::shared_ptr udp_listener_; + std::map> kcp_session_hash_; }; diff --git a/third_party/a8 b/third_party/a8 index dd650c0..0f16fe1 160000 --- a/third_party/a8 +++ b/third_party/a8 @@ -1 +1 @@ -Subproject commit dd650c0bcab90d91a92d0a89b1b8fd7317cc971c +Subproject commit 0f16fe15137de458a690699e29beff23799a764f