STUN allocation should not be disabled when using shared port and TURN servers are provided.
BUG=
R=juberti@google.com, pthatcher@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/48229004
Cr-Commit-Position: refs/heads/master@{#9091}
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 5c322da..41edd85 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -412,11 +412,6 @@
break;
}
- // Disables phases that are not specified in this config.
- if (!config || config->StunServers().empty()) {
- // No STUN ports specified in this config.
- sequence_flags |= PORTALLOCATOR_DISABLE_STUN;
- }
if (!config || config->relays.empty()) {
// No relay ports specified in this config.
sequence_flags |= PORTALLOCATOR_DISABLE_RELAY;
@@ -980,9 +975,6 @@
return;
}
- // If BasicPortAllocatorSession::OnAllocate left STUN ports enabled then we
- // ought to have an address for them here.
- ASSERT(config_ && !config_->StunServers().empty());
if (!(config_ && !config_->StunServers().empty())) {
LOG(LS_WARNING)
<< "AllocationSequence: No STUN server configured, skipping.";
diff --git a/webrtc/p2p/client/portallocator_unittest.cc b/webrtc/p2p/client/portallocator_unittest.cc
index 0173261..148623d 100644
--- a/webrtc/p2p/client/portallocator_unittest.cc
+++ b/webrtc/p2p/client/portallocator_unittest.cc
@@ -116,7 +116,9 @@
rtc::NAT_OPEN_CONE, vss_.get(), kNatAddr, vss_.get(), kNatAddr));
ServerAddresses stun_servers;
- stun_servers.insert(stun_server);
+ if (!stun_server.IsNil()) {
+ stun_servers.insert(stun_server);
+ }
allocator_.reset(new cricket::BasicPortAllocator(
&network_manager_, &nat_socket_factory_, stun_servers));
allocator().set_step_delay(cricket::kMinimumStepDelay);
@@ -873,7 +875,8 @@
// 'relay' candidates.
TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurnAsStun) {
AddInterface(kClientAddr);
- ResetWithNatServer(kTurnUdpIntAddr);
+ // Use an empty SocketAddress to add a NAT without STUN server.
+ ResetWithNatServer(SocketAddress());
AddTurnServers(kTurnUdpIntAddr, rtc::SocketAddress());
// Must set the step delay to 0 to make sure the relay allocation phase is