diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /third_party/libwebrtc/rtc_base/nat_server.cc | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/rtc_base/nat_server.cc')
-rw-r--r-- | third_party/libwebrtc/rtc_base/nat_server.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/third_party/libwebrtc/rtc_base/nat_server.cc b/third_party/libwebrtc/rtc_base/nat_server.cc index c274cedf18..f21d404bd3 100644 --- a/third_party/libwebrtc/rtc_base/nat_server.cc +++ b/third_party/libwebrtc/rtc_base/nat_server.cc @@ -11,8 +11,10 @@ #include "rtc_base/nat_server.h" #include <cstddef> +#include <cstdint> #include <memory> +#include "api/array_view.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #include "rtc_base/nat_socket_factory.h" @@ -97,8 +99,9 @@ class NATProxyServerSocket : public AsyncProxyServerSocket { } SocketAddress dest_addr; - size_t address_length = UnpackAddressFromNAT(data, *len, &dest_addr); - + size_t address_length = UnpackAddressFromNAT( + MakeArrayView(reinterpret_cast<const uint8_t*>(data), *len), + &dest_addr); *len -= address_length; if (*len > 0) { memmove(data, data + address_length, *len); @@ -171,15 +174,12 @@ NATServer::~NATServer() { void NATServer::OnInternalUDPPacket(AsyncPacketSocket* socket, const rtc::ReceivedPacket& packet) { RTC_DCHECK(internal_socket_thread_.IsCurrent()); - const char* buf = reinterpret_cast<const char*>(packet.payload().data()); - size_t size = packet.payload().size(); - const SocketAddress& addr = packet.source_address(); // Read the intended destination from the wire. SocketAddress dest_addr; - size_t length = UnpackAddressFromNAT(buf, size, &dest_addr); + size_t length = UnpackAddressFromNAT(packet.payload(), &dest_addr); // Find the translation for these addresses (allocating one if necessary). - SocketAddressPair route(addr, dest_addr); + SocketAddressPair route(packet.source_address(), dest_addr); InternalMap::iterator iter = int_map_->find(route); if (iter == int_map_->end()) { Translate(route); @@ -192,6 +192,8 @@ void NATServer::OnInternalUDPPacket(AsyncPacketSocket* socket, // Send the packet to its intended destination. rtc::PacketOptions options; + const char* buf = reinterpret_cast<const char*>(packet.payload().data()); + size_t size = packet.payload().size(); iter->second->socket->SendTo(buf + length, size - length, dest_addr, options); } |