diff options
author | mallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-26 00:36:56 +0000 |
---|---|---|
committer | mallinath@chromium.org <mallinath@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-26 00:36:56 +0000 |
commit | 339b0217ce8e0347b199da247f547bdb672e422c (patch) | |
tree | effc5903b21e1a3c9a1fb0694ff5a14d1f82ebd0 /content | |
parent | 82718cb25820d4fd1175f8af96975b7f2971aecd (diff) | |
download | chromium_src-339b0217ce8e0347b199da247f547bdb672e422c.zip chromium_src-339b0217ce8e0347b199da247f547bdb672e422c.tar.gz chromium_src-339b0217ce8e0347b199da247f547bdb672e422c.tar.bz2 |
When BUNDLE is enabled in libjingle, there will be a possibility
of sending multiple stun queries. That because PortAllocator will
create only one real PortAlloctorSession and many proxies for that
session. Proxies can come and go but the real impl of PortAllocatorSession
will remain. Due to this P2PTC channel will call GetInitialPorts and
StartGetAllPorts many times.
Review URL: https://chromiumcodereview.appspot.com/10444032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/renderer/p2p/host_address_request.cc | 3 | ||||
-rw-r--r-- | content/renderer/p2p/port_allocator.cc | 27 |
2 files changed, 19 insertions, 11 deletions
diff --git a/content/renderer/p2p/host_address_request.cc b/content/renderer/p2p/host_address_request.cc index 57c63ff..68aa4ff 100644 --- a/content/renderer/p2p/host_address_request.cc +++ b/content/renderer/p2p/host_address_request.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,6 +28,7 @@ P2PHostAddressRequest::~P2PHostAddressRequest() { void P2PHostAddressRequest::Request(const std::string& host_name, const DoneCallback& done_callback) { DCHECK(delegate_message_loop_->BelongsToCurrentThread()); + DCHECK_EQ(STATE_CREATED, state_); state_ = STATE_SENT; ipc_message_loop_->PostTask(FROM_HERE, base::Bind( diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc index a85c92d..ae9417e 100644 --- a/content/renderer/p2p/port_allocator.cc +++ b/content/renderer/p2p/port_allocator.cc @@ -132,20 +132,27 @@ void P2PPortAllocatorSession::GetPortConfigurations() { // can be started immediately. ConfigReady(new cricket::PortConfiguration(talk_base::SocketAddress())); - ResolveStunServerAddress(); + if (stun_server_address_.IsNil()) { + ResolveStunServerAddress(); + } else { + AddConfig(); + } + AllocateRelaySession(); } void P2PPortAllocatorSession::ResolveStunServerAddress() { - if (allocator_->config_.stun_server.empty()) - return; - - DCHECK(!stun_address_request_); - stun_address_request_ = - new P2PHostAddressRequest(allocator_->socket_dispatcher_); - stun_address_request_->Request(allocator_->config_.stun_server, base::Bind( - &P2PPortAllocatorSession::OnStunServerAddress, - base::Unretained(this))); + if (allocator_->config_.stun_server.empty()) + return; + + if (stun_address_request_) + return; + + stun_address_request_ = + new P2PHostAddressRequest(allocator_->socket_dispatcher_); + stun_address_request_->Request(allocator_->config_.stun_server, base::Bind( + &P2PPortAllocatorSession::OnStunServerAddress, + base::Unretained(this))); } void P2PPortAllocatorSession::OnStunServerAddress( |