Change Port::Type() to IceCandidateType
Bug: webrtc:15846 Change-Id: Ibda55129f13d22ac84a730ba54d915c81a90cde9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/340041 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#41891}
This commit is contained in:
parent
9849bfdb10
commit
6417bbfd80
@ -1410,7 +1410,7 @@ bool P2PTransportChannel::CreateConnection(PortInterface* port,
|
||||
}
|
||||
|
||||
if (ice_field_trials_.skip_relay_to_non_relay_connections) {
|
||||
IceCandidateType port_type = PortTypeToIceCandidateType(port->Type());
|
||||
IceCandidateType port_type = port->Type();
|
||||
if ((port_type != remote_candidate.type()) &&
|
||||
(port_type == IceCandidateType::kRelay ||
|
||||
remote_candidate.is_relay())) {
|
||||
@ -1758,7 +1758,7 @@ rtc::NetworkRoute P2PTransportChannel::ConfigureNetworkRoute(
|
||||
.local = CreateRouteEndpointFromCandidate(
|
||||
/* local= */ true, conn->local_candidate(),
|
||||
/* uses_turn= */
|
||||
conn->port()->Type() == RELAY_PORT_TYPE),
|
||||
conn->port()->Type() == IceCandidateType::kRelay),
|
||||
.remote = CreateRouteEndpointFromCandidate(
|
||||
/* local= */ false, conn->remote_candidate(),
|
||||
/* uses_turn= */ conn->remote_candidate().is_relay()),
|
||||
|
||||
@ -5031,8 +5031,8 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
|
||||
P2PTransportChannel& ch =
|
||||
StartTransportChannel(true, max_strong_interval, &field_trials_);
|
||||
EXPECT_TRUE_WAIT(ch.ports().size() == 2, kDefaultTimeout);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), IceCandidateType::kHost);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), IceCandidateType::kRelay);
|
||||
|
||||
ch.AddRemoteCandidate(
|
||||
CreateUdpCandidate(IceCandidateType::kRelay, "1.1.1.1", 1, 1));
|
||||
@ -5092,8 +5092,8 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
|
||||
TestRelayRelayFirstWhenEverythingPinged) {
|
||||
P2PTransportChannel& ch = StartTransportChannel(true, 500, &field_trials_);
|
||||
EXPECT_TRUE_WAIT(ch.ports().size() == 2, kDefaultTimeout);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), IceCandidateType::kHost);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), IceCandidateType::kRelay);
|
||||
|
||||
ch.AddRemoteCandidate(
|
||||
CreateUdpCandidate(IceCandidateType::kHost, "1.1.1.1", 1, 1));
|
||||
@ -5130,8 +5130,8 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
|
||||
TestNoStarvationOnNonRelayConnection) {
|
||||
P2PTransportChannel& ch = StartTransportChannel(true, 500, &field_trials_);
|
||||
EXPECT_TRUE_WAIT(ch.ports().size() == 2, kDefaultTimeout);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), IceCandidateType::kHost);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), IceCandidateType::kRelay);
|
||||
|
||||
ch.AddRemoteCandidate(
|
||||
CreateUdpCandidate(IceCandidateType::kRelay, "1.1.1.1", 1, 1));
|
||||
@ -5173,8 +5173,8 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest,
|
||||
"WebRTC-IceFieldTrials/skip_relay_to_non_relay_connections:true/");
|
||||
P2PTransportChannel& ch = StartTransportChannel(true, 500, &field_trials);
|
||||
EXPECT_TRUE_WAIT(ch.ports().size() == 2, kDefaultTimeout);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), IceCandidateType::kHost);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), IceCandidateType::kRelay);
|
||||
|
||||
// Remote Relay candidate arrives.
|
||||
ch.AddRemoteCandidate(
|
||||
@ -5199,9 +5199,9 @@ TEST_F(P2PTransportChannelMostLikelyToWorkFirstTest, TestTcpTurn) {
|
||||
|
||||
P2PTransportChannel& ch = StartTransportChannel(true, 500, &field_trials_);
|
||||
EXPECT_TRUE_WAIT(ch.ports().size() == 3, kDefaultTimeout);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), LOCAL_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[2]->Type(), RELAY_PORT_TYPE);
|
||||
EXPECT_EQ(ch.ports()[0]->Type(), IceCandidateType::kHost);
|
||||
EXPECT_EQ(ch.ports()[1]->Type(), IceCandidateType::kRelay);
|
||||
EXPECT_EQ(ch.ports()[2]->Type(), IceCandidateType::kRelay);
|
||||
|
||||
// Remote Relay candidate arrives.
|
||||
ch.AddRemoteCandidate(
|
||||
|
||||
@ -176,12 +176,8 @@ Port::~Port() {
|
||||
CancelPendingTasks();
|
||||
}
|
||||
|
||||
const absl::string_view Port::Type() const {
|
||||
if (type_ == webrtc::IceCandidateType::kHost)
|
||||
return "local";
|
||||
if (type_ == webrtc::IceCandidateType::kSrflx)
|
||||
return "stun";
|
||||
return webrtc::IceCandidateTypeToString(type_);
|
||||
IceCandidateType Port::Type() const {
|
||||
return type_;
|
||||
}
|
||||
const rtc::Network* Port::Network() const {
|
||||
return network_;
|
||||
|
||||
@ -241,7 +241,7 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
|
||||
// uniquely identify subclasses. Whenever a new subclass of Port introduces a
|
||||
// conflict in the value of the 2-tuple, make sure that the implementation
|
||||
// that relies on this 2-tuple for RTTI is properly changed.
|
||||
const absl::string_view Type() const override;
|
||||
webrtc::IceCandidateType Type() const override;
|
||||
const rtc::Network* Network() const override;
|
||||
|
||||
// Methods to set/get ICE role and tiebreaker values.
|
||||
|
||||
@ -52,8 +52,7 @@ class PortInterface {
|
||||
public:
|
||||
virtual ~PortInterface();
|
||||
|
||||
// TODO: bugs.webrtc.org/15846 - Change return type to IceCandidateType.
|
||||
virtual const absl::string_view Type() const = 0;
|
||||
virtual webrtc::IceCandidateType Type() const = 0;
|
||||
virtual const rtc::Network* Network() const = 0;
|
||||
|
||||
// Methods to set/get ICE role and tiebreaker values.
|
||||
|
||||
@ -35,6 +35,7 @@ using ::testing::DoAll;
|
||||
using ::testing::Return;
|
||||
using ::testing::ReturnPointee;
|
||||
using ::testing::SetArgPointee;
|
||||
using webrtc::IceCandidateType;
|
||||
|
||||
static const SocketAddress kLocalAddr("127.0.0.1", 0);
|
||||
static const SocketAddress kIPv6LocalAddr("::1", 0);
|
||||
@ -261,14 +262,14 @@ class StunPortTest : public FakeClockBase, public StunPortTestBase {};
|
||||
// Test that we can create a STUN port.
|
||||
TEST_F(StunPortTest, TestCreateStunPort) {
|
||||
CreateStunPort(kStunAddr1);
|
||||
EXPECT_EQ("stun", port()->Type());
|
||||
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
|
||||
EXPECT_EQ(0U, port()->Candidates().size());
|
||||
}
|
||||
|
||||
// Test that we can create a UDP port.
|
||||
TEST_F(StunPortTest, TestCreateUdpPort) {
|
||||
CreateSharedUdpPort(kStunAddr1, nullptr);
|
||||
EXPECT_EQ("local", port()->Type());
|
||||
EXPECT_EQ(IceCandidateType::kHost, port()->Type());
|
||||
EXPECT_EQ(0U, port()->Candidates().size());
|
||||
}
|
||||
|
||||
@ -460,7 +461,7 @@ TEST_F(StunPortTest, TestNoDuplicatedAddressWithTwoStunServers) {
|
||||
stun_servers.insert(kStunAddr1);
|
||||
stun_servers.insert(kStunAddr2);
|
||||
CreateStunPort(stun_servers);
|
||||
EXPECT_EQ("stun", port()->Type());
|
||||
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
|
||||
PrepareAddress();
|
||||
EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock);
|
||||
EXPECT_EQ(1U, port()->Candidates().size());
|
||||
@ -474,7 +475,7 @@ TEST_F(StunPortTest, TestMultipleStunServersWithBadServer) {
|
||||
stun_servers.insert(kStunAddr1);
|
||||
stun_servers.insert(kBadAddr);
|
||||
CreateStunPort(stun_servers);
|
||||
EXPECT_EQ("stun", port()->Type());
|
||||
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
|
||||
PrepareAddress();
|
||||
EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock);
|
||||
EXPECT_EQ(1U, port()->Candidates().size());
|
||||
@ -495,7 +496,7 @@ TEST_F(StunPortTest, TestTwoCandidatesWithTwoStunServersAcrossNat) {
|
||||
stun_servers.insert(kStunAddr1);
|
||||
stun_servers.insert(kStunAddr2);
|
||||
CreateStunPort(stun_servers);
|
||||
EXPECT_EQ("stun", port()->Type());
|
||||
EXPECT_EQ(IceCandidateType::kSrflx, port()->Type());
|
||||
PrepareAddress();
|
||||
EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock);
|
||||
EXPECT_EQ(2U, port()->Candidates().size());
|
||||
|
||||
@ -865,7 +865,7 @@ class TurnPortTest : public ::testing::Test,
|
||||
|
||||
TEST_F(TurnPortTest, TestTurnPortType) {
|
||||
CreateTurnPort(kTurnUsername, kTurnPassword, kTurnUdpProtoAddr);
|
||||
EXPECT_EQ(cricket::RELAY_PORT_TYPE, turn_port_->Type());
|
||||
EXPECT_EQ(IceCandidateType::kRelay, turn_port_->Type());
|
||||
}
|
||||
|
||||
// Tests that the URL of the servers can be correctly reconstructed when
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
namespace cricket {
|
||||
namespace {
|
||||
using ::rtc::CreateRandomId;
|
||||
using ::webrtc::IceCandidateType;
|
||||
using ::webrtc::SafeTask;
|
||||
using ::webrtc::TimeDelta;
|
||||
|
||||
@ -509,9 +510,10 @@ void BasicPortAllocatorSession::SetStunKeepaliveIntervalForReadyPorts(
|
||||
for (PortInterface* port : ports) {
|
||||
// The port type and protocol can be used to identify different subclasses
|
||||
// of Port in the current implementation. Note that a TCPPort has the type
|
||||
// LOCAL_PORT_TYPE but uses the protocol PROTO_TCP.
|
||||
if (port->Type() == STUN_PORT_TYPE ||
|
||||
(port->Type() == LOCAL_PORT_TYPE && port->GetProtocol() == PROTO_UDP)) {
|
||||
// IceCandidateType::kHost but uses the protocol PROTO_TCP.
|
||||
if (port->Type() == IceCandidateType::kSrflx ||
|
||||
(port->Type() == IceCandidateType::kHost &&
|
||||
port->GetProtocol() == PROTO_UDP)) {
|
||||
static_cast<UDPPort*>(port)->set_stun_keepalive_delay(
|
||||
stun_keepalive_interval);
|
||||
}
|
||||
@ -993,7 +995,7 @@ void BasicPortAllocatorSession::OnCandidateReady(Port* port,
|
||||
if (CandidatePairable(c, port) && !data->has_pairable_candidate()) {
|
||||
data->set_has_pairable_candidate(true);
|
||||
|
||||
if (port->Type() == RELAY_PORT_TYPE) {
|
||||
if (port->Type() == IceCandidateType::kRelay) {
|
||||
if (turn_port_prune_policy_ == webrtc::KEEP_FIRST_READY) {
|
||||
pruned = PruneNewlyPairableTurnPort(data);
|
||||
} else if (turn_port_prune_policy_ == webrtc::PRUNE_BASED_ON_PRIORITY) {
|
||||
@ -1041,7 +1043,7 @@ Port* BasicPortAllocatorSession::GetBestTurnPortForNetwork(
|
||||
Port* best_turn_port = nullptr;
|
||||
for (const PortData& data : ports_) {
|
||||
if (data.port()->Network()->name() == network_name &&
|
||||
data.port()->Type() == RELAY_PORT_TYPE && data.ready() &&
|
||||
data.port()->Type() == IceCandidateType::kRelay && data.ready() &&
|
||||
(!best_turn_port || ComparePort(data.port(), best_turn_port) > 0)) {
|
||||
best_turn_port = data.port();
|
||||
}
|
||||
@ -1052,7 +1054,8 @@ Port* BasicPortAllocatorSession::GetBestTurnPortForNetwork(
|
||||
bool BasicPortAllocatorSession::PruneNewlyPairableTurnPort(
|
||||
PortData* newly_pairable_port_data) {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
RTC_DCHECK(newly_pairable_port_data->port()->Type() == RELAY_PORT_TYPE);
|
||||
RTC_DCHECK(newly_pairable_port_data->port()->Type() ==
|
||||
IceCandidateType::kRelay);
|
||||
// If an existing turn port is ready on the same network, prune the newly
|
||||
// pairable port.
|
||||
const std::string& network_name =
|
||||
@ -1060,7 +1063,7 @@ bool BasicPortAllocatorSession::PruneNewlyPairableTurnPort(
|
||||
|
||||
for (PortData& data : ports_) {
|
||||
if (data.port()->Network()->name() == network_name &&
|
||||
data.port()->Type() == RELAY_PORT_TYPE && data.ready() &&
|
||||
data.port()->Type() == IceCandidateType::kRelay && data.ready() &&
|
||||
&data != newly_pairable_port_data) {
|
||||
RTC_LOG(LS_INFO) << "Port pruned: "
|
||||
<< newly_pairable_port_data->port()->ToString();
|
||||
@ -1085,7 +1088,7 @@ bool BasicPortAllocatorSession::PruneTurnPorts(Port* newly_pairable_turn_port) {
|
||||
std::vector<PortData*> ports_to_prune;
|
||||
for (PortData& data : ports_) {
|
||||
if (data.port()->Network()->name() == network_name &&
|
||||
data.port()->Type() == RELAY_PORT_TYPE && !data.pruned() &&
|
||||
data.port()->Type() == IceCandidateType::kRelay && !data.pruned() &&
|
||||
ComparePort(data.port(), best_turn_port) < 0) {
|
||||
pruned = true;
|
||||
if (data.port() != newly_pairable_turn_port) {
|
||||
@ -1354,7 +1357,8 @@ void AllocationSequence::DisableEquivalentPhases(const rtc::Network* network,
|
||||
[this](const BasicPortAllocatorSession::PortData& p) {
|
||||
return !p.pruned() && p.port()->Network() == network_ &&
|
||||
p.port()->GetProtocol() == PROTO_UDP &&
|
||||
p.port()->Type() == LOCAL_PORT_TYPE && !p.error();
|
||||
p.port()->Type() == IceCandidateType::kHost &&
|
||||
!p.error();
|
||||
})) {
|
||||
*flags |= PORTALLOCATOR_DISABLE_UDP;
|
||||
}
|
||||
@ -1364,7 +1368,8 @@ void AllocationSequence::DisableEquivalentPhases(const rtc::Network* network,
|
||||
[this](const BasicPortAllocatorSession::PortData& p) {
|
||||
return !p.pruned() && p.port()->Network() == network_ &&
|
||||
p.port()->GetProtocol() == PROTO_TCP &&
|
||||
p.port()->Type() == LOCAL_PORT_TYPE && !p.error();
|
||||
p.port()->Type() == IceCandidateType::kHost &&
|
||||
!p.error();
|
||||
})) {
|
||||
*flags |= PORTALLOCATOR_DISABLE_TCP;
|
||||
}
|
||||
|
||||
@ -120,8 +120,8 @@ void CheckStunKeepaliveIntervalOfAllReadyPorts(
|
||||
int expected) {
|
||||
auto ready_ports = allocator_session->ReadyPorts();
|
||||
for (const auto* port : ready_ports) {
|
||||
if (port->Type() == cricket::STUN_PORT_TYPE ||
|
||||
(port->Type() == cricket::LOCAL_PORT_TYPE &&
|
||||
if (port->Type() == IceCandidateType::kSrflx ||
|
||||
(port->Type() == IceCandidateType::kHost &&
|
||||
port->GetProtocol() == cricket::PROTO_UDP)) {
|
||||
EXPECT_EQ(
|
||||
static_cast<const cricket::UDPPort*>(port)->stun_keepalive_delay(),
|
||||
@ -314,7 +314,7 @@ class BasicPortAllocatorTestBase : public ::testing::Test,
|
||||
// Returns the number of ports that have matching type, protocol and
|
||||
// address.
|
||||
static int CountPorts(const std::vector<PortInterface*>& ports,
|
||||
absl::string_view type,
|
||||
IceCandidateType type,
|
||||
ProtocolType protocol,
|
||||
const SocketAddress& client_addr) {
|
||||
return absl::c_count_if(
|
||||
@ -613,10 +613,14 @@ class BasicPortAllocatorTest : public FakeClockBase,
|
||||
// Three ports (one IPv4 STUN, one IPv6 STUN and one TURN) will be ready.
|
||||
EXPECT_EQ(3U, session_->ReadyPorts().size());
|
||||
EXPECT_EQ(3U, ports_.size());
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "relay", PROTO_UDP, kClientIPv6Addr));
|
||||
EXPECT_EQ(0, CountPorts(ports_, "relay", PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(
|
||||
1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
|
||||
kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
|
||||
kClientIPv6Addr));
|
||||
EXPECT_EQ(0, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
|
||||
kClientAddr));
|
||||
|
||||
// Now that we remove candidates when a TURN port is pruned, there will be
|
||||
// exactly 3 candidates in both `candidates_` and `ready_candidates`.
|
||||
@ -656,12 +660,13 @@ class BasicPortAllocatorTest : public FakeClockBase,
|
||||
// found in `ready_ports`, and when it is pruned, it is not found in
|
||||
// `ready_ports`, so we only need to verify the content in one of them.
|
||||
EXPECT_EQ(2U, ports_.size());
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(
|
||||
1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
|
||||
int num_udp_ports = tcp_pruned ? 1 : 0;
|
||||
EXPECT_EQ(num_udp_ports,
|
||||
CountPorts(ports_, "relay", PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1 - num_udp_ports,
|
||||
CountPorts(ports_, "relay", PROTO_TCP, kClientAddr));
|
||||
EXPECT_EQ(num_udp_ports, CountPorts(ports_, IceCandidateType::kRelay,
|
||||
PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1 - num_udp_ports, CountPorts(ports_, IceCandidateType::kRelay,
|
||||
PROTO_TCP, kClientAddr));
|
||||
|
||||
// Now that we remove candidates when a TURN port is pruned, `candidates_`
|
||||
// should only contains two candidates regardless whether the TCP TURN port
|
||||
@ -711,16 +716,26 @@ class BasicPortAllocatorTest : public FakeClockBase,
|
||||
// use.
|
||||
EXPECT_EQ(10U, session_->ReadyPorts().size());
|
||||
EXPECT_EQ(10U, ports_.size());
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientAddr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_UDP, kClientIPv6Addr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kClientAddr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kClientIPv6Addr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "relay", PROTO_UDP, kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "relay", PROTO_UDP, kClientIPv6Addr2));
|
||||
EXPECT_EQ(
|
||||
1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
|
||||
kClientAddr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
|
||||
kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_UDP,
|
||||
kClientIPv6Addr2));
|
||||
EXPECT_EQ(
|
||||
1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP, kClientAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
|
||||
kClientAddr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
|
||||
kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP,
|
||||
kClientIPv6Addr2));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
|
||||
kClientIPv6Addr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP,
|
||||
kClientIPv6Addr2));
|
||||
|
||||
// Now that we remove candidates when TURN ports are pruned, there will be
|
||||
// exactly 10 candidates in `candidates_`.
|
||||
@ -1268,11 +1283,15 @@ TEST_F(BasicPortAllocatorTest, TestGetAllPortsNoAdapters) {
|
||||
EXPECT_TRUE_SIMULATED_WAIT(candidate_allocation_done_,
|
||||
kDefaultAllocationTimeout, fake_clock);
|
||||
EXPECT_EQ(4U, ports_.size());
|
||||
EXPECT_EQ(1, CountPorts(ports_, "stun", PROTO_UDP, kAnyAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "local", PROTO_TCP, kAnyAddr));
|
||||
EXPECT_EQ(1,
|
||||
CountPorts(ports_, IceCandidateType::kSrflx, PROTO_UDP, kAnyAddr));
|
||||
EXPECT_EQ(1,
|
||||
CountPorts(ports_, IceCandidateType::kHost, PROTO_TCP, kAnyAddr));
|
||||
// Two TURN ports, using UDP/TCP for the first hop to the TURN server.
|
||||
EXPECT_EQ(1, CountPorts(ports_, "relay", PROTO_UDP, kAnyAddr));
|
||||
EXPECT_EQ(1, CountPorts(ports_, "relay", PROTO_TCP, kAnyAddr));
|
||||
EXPECT_EQ(1,
|
||||
CountPorts(ports_, IceCandidateType::kRelay, PROTO_UDP, kAnyAddr));
|
||||
EXPECT_EQ(1,
|
||||
CountPorts(ports_, IceCandidateType::kRelay, PROTO_TCP, kAnyAddr));
|
||||
// The "any" address port should be in the signaled ready ports, but the host
|
||||
// candidate for it is useless and shouldn't be signaled. So we only have
|
||||
// STUN/TURN candidates.
|
||||
@ -2203,7 +2222,7 @@ TEST_F(BasicPortAllocatorTest, TestSetCandidateFilterAfterCandidatesGathered) {
|
||||
EXPECT_GT(initial_ports_size, ports.size());
|
||||
for (const PortInterface* port : ports) {
|
||||
// Expect only relay ports.
|
||||
EXPECT_EQ(RELAY_PORT_TYPE, port->Type());
|
||||
EXPECT_EQ(IceCandidateType::kRelay, port->Type());
|
||||
}
|
||||
for (const Candidate& candidate : candidates) {
|
||||
// Expect only relay candidates now that the filter is applied.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user