summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/p2p/client
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/p2p/client')
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator.cc22
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator.h8
-rw-r--r--third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc4
3 files changed, 15 insertions, 19 deletions
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
index b6cbf1fff9..e8255f1fd5 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
@@ -1308,8 +1308,11 @@ void AllocationSequence::Init() {
rtc::SocketAddress(network_->GetBestIP(), 0),
session_->allocator()->min_port(), session_->allocator()->max_port()));
if (udp_socket_) {
- udp_socket_->SignalReadPacket.connect(this,
- &AllocationSequence::OnReadPacket);
+ udp_socket_->RegisterReceivedPacketCallback(
+ [&](rtc::AsyncPacketSocket* socket,
+ const rtc::ReceivedPacket& packet) {
+ OnReadPacket(socket, packet);
+ });
}
// Continuing if `udp_socket_` is NULL, as local TCP and RelayPort using TCP
// are next available options to setup a communication channel.
@@ -1668,10 +1671,7 @@ void AllocationSequence::CreateTurnPort(const RelayServerConfig& config,
}
void AllocationSequence::OnReadPacket(rtc::AsyncPacketSocket* socket,
- const char* data,
- size_t size,
- const rtc::SocketAddress& remote_addr,
- const int64_t& packet_time_us) {
+ const rtc::ReceivedPacket& packet) {
RTC_DCHECK(socket == udp_socket_.get());
bool turn_port_found = false;
@@ -1683,9 +1683,8 @@ void AllocationSequence::OnReadPacket(rtc::AsyncPacketSocket* socket,
// the message type. The TurnPort will just ignore the message since it will
// not find any request by transaction ID.
for (auto* port : relay_ports_) {
- if (port->CanHandleIncomingPacketsFrom(remote_addr)) {
- if (port->HandleIncomingPacket(socket, data, size, remote_addr,
- packet_time_us)) {
+ if (port->CanHandleIncomingPacketsFrom(packet.source_address())) {
+ if (port->HandleIncomingPacket(socket, packet)) {
return;
}
turn_port_found = true;
@@ -1698,10 +1697,9 @@ void AllocationSequence::OnReadPacket(rtc::AsyncPacketSocket* socket,
// Pass the packet to the UdpPort if there is no matching TurnPort, or if
// the TURN server is also a STUN server.
if (!turn_port_found ||
- stun_servers.find(remote_addr) != stun_servers.end()) {
+ stun_servers.find(packet.source_address()) != stun_servers.end()) {
RTC_DCHECK(udp_port_->SharedSocket());
- udp_port_->HandleIncomingPacket(socket, data, size, remote_addr,
- packet_time_us);
+ udp_port_->HandleIncomingPacket(socket, packet);
}
}
}
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator.h b/third_party/libwebrtc/p2p/client/basic_port_allocator.h
index 95bbdb183e..643904ab27 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator.h
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator.h
@@ -25,6 +25,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/memory/always_valid_pointer.h"
#include "rtc_base/network.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
@@ -330,7 +331,7 @@ class TurnPort;
// Performs the allocation of ports, in a sequenced (timed) manner, for a given
// network and IP address.
// This class is thread-compatible.
-class AllocationSequence : public sigslot::has_slots<> {
+class AllocationSequence {
public:
enum State {
kInit, // Initial state.
@@ -386,10 +387,7 @@ class AllocationSequence : public sigslot::has_slots<> {
void CreateRelayPorts();
void OnReadPacket(rtc::AsyncPacketSocket* socket,
- const char* data,
- size_t size,
- const rtc::SocketAddress& remote_addr,
- const int64_t& packet_time_us);
+ const rtc::ReceivedPacket& packet);
void OnPortDestroyed(PortInterface* port);
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
index 55222a1be2..defcab01c9 100644
--- a/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
+++ b/third_party/libwebrtc/p2p/client/basic_port_allocator_unittest.cc
@@ -163,7 +163,7 @@ class BasicPortAllocatorTestBase : public ::testing::Test,
// must be called.
nat_factory_(vss_.get(), kNatUdpAddr, kNatTcpAddr),
nat_socket_factory_(new rtc::BasicPacketSocketFactory(&nat_factory_)),
- stun_server_(TestStunServer::Create(fss_.get(), kStunAddr)),
+ stun_server_(TestStunServer::Create(fss_.get(), kStunAddr, thread_)),
turn_server_(rtc::Thread::Current(),
fss_.get(),
kTurnUdpIntAddr,
@@ -521,7 +521,7 @@ class BasicPortAllocatorTestBase : public ::testing::Test,
std::unique_ptr<rtc::NATServer> nat_server_;
rtc::NATSocketFactory nat_factory_;
std::unique_ptr<rtc::BasicPacketSocketFactory> nat_socket_factory_;
- std::unique_ptr<TestStunServer> stun_server_;
+ TestStunServer::StunServerPtr stun_server_;
TestTurnServer turn_server_;
rtc::FakeNetworkManager network_manager_;
std::unique_ptr<BasicPortAllocator> allocator_;