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}
This commit is contained in:
Jiayang Liu 2015-04-27 11:47:21 -07:00
parent 5a92aa8440
commit d7e5c44e94
2 changed files with 5 additions and 10 deletions

View File

@ -412,11 +412,6 @@ void BasicPortAllocatorSession::DoAllocate() {
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 @@ void AllocationSequence::CreateStunPorts() {
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.";

View File

@ -116,7 +116,9 @@ class PortAllocatorTest : public testing::Test, public sigslot::has_slots<> {
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 @@ TEST_F(PortAllocatorTest, TestSharedSocketWithNatUsingTurn) {
// '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