From 08329b39bf36c141b0a12c2bcceb819456632d9b Mon Sep 17 00:00:00 2001 From: baigao <1007668733@qq.com> Date: Mon, 12 Oct 2026 20:42:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DICEAgent=20Data=20Indi?= =?UTF-8?q?cations=E5=8D=8F=E8=AE=AE=E5=A4=84=E7=90=86=E4=BB=85=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=88=B0=E7=AC=AC=E4=B8=80=E4=B8=AA=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#4848)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/IceTransport.cpp | 9 ++------- webrtc/IceTransport.hpp | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/webrtc/IceTransport.cpp b/webrtc/IceTransport.cpp index 9f8fd14d..0ea972a2 100644 --- a/webrtc/IceTransport.cpp +++ b/webrtc/IceTransport.cpp @@ -1214,6 +1214,8 @@ IceAgent::IceAgent(Listener* listener, Implementation implementation, Role role, : IceTransport(listener, std::move(ufrag), std::move(password), std::move(poller)), _implementation(implementation) ,_role(role) { DebugL; _tiebreaker = makeRandNum(); + _request_handlers.emplace(std::make_pair(StunPacket::Class::INDICATION, StunPacket::Method::DATA), + std::bind(&IceAgent::handleDataIndication, this, placeholders::_1, placeholders::_2)); // 创建定时器,每分钟检查一次权限和通道绑定是否需要刷新 _refresh_timer = std::make_shared(60.0f, [this]() { refreshPermissions(); @@ -1457,13 +1459,6 @@ void IceAgent::sendChannelBindRequest(const Pair::Ptr& pair, uint16_t channel_nu sendRequest(packet, pair, std::move(handler)); } -void IceAgent::processRequest(const StunPacket::Ptr& packet, const Pair::Ptr& pair) { - static toolkit::onceToken token([this]() { - _request_handlers.emplace(std::make_pair(StunPacket::Class::INDICATION, StunPacket::Method::DATA), std::bind(&IceAgent::handleDataIndication, this, placeholders::_1, placeholders::_2)); - }); - return IceTransport::processRequest(packet, pair); -} - void IceAgent::handleBindingRequest(const StunPacket::Ptr& packet, const Pair::Ptr& pair) { // TraceL; auto controlling = packet->getAttribute(); diff --git a/webrtc/IceTransport.hpp b/webrtc/IceTransport.hpp index 60cf25c8..f20fb4b4 100644 --- a/webrtc/IceTransport.hpp +++ b/webrtc/IceTransport.hpp @@ -592,8 +592,6 @@ protected: void sendCreatePermissionRequest(const Pair::Ptr& pair, const sockaddr_storage& peer_addr); void sendChannelBindRequest(const Pair::Ptr& pair, uint16_t channel_number, const sockaddr_storage& peer_addr); - void processRequest(const StunPacket::Ptr& packet, const Pair::Ptr& pair) override; - void handleBindingRequest(const StunPacket::Ptr& packet, const Pair::Ptr& pair) override; void handleGatheringCandidateResponse(const StunPacket::Ptr& packet, const Pair::Ptr& pair); void handleConnectivityCheckResponse(const StunPacket::Ptr& packet, const Pair::Ptr& pair, CandidateTuple& candidate);