diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc index ebe59bfb95..d4d0e5e327 100644 --- a/webrtc/p2p/base/p2ptransportchannel.cc +++ b/webrtc/p2p/base/p2ptransportchannel.cc @@ -461,6 +461,7 @@ void P2PTransportChannel::MaybeStartGathering() { } else { AddAllocatorSession(allocator_->CreateSession( transport_name(), component(), ice_ufrag_, ice_pwd_)); + LOG(LS_INFO) << "Start getting ports"; allocator_sessions_.back()->StartGettingPorts(); } } diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc index 55b1fd8875..6234d77b75 100644 --- a/webrtc/p2p/client/basicportallocator.cc +++ b/webrtc/p2p/client/basicportallocator.cc @@ -549,10 +549,14 @@ void BasicPortAllocatorSession::DoAllocate() { bool done_signal_needed = false; std::vector networks = GetNetworks(); + if (IsStopped()) { + return; + } if (networks.empty()) { LOG(LS_WARNING) << "Machine has no networks; no ports will be allocated"; done_signal_needed = true; } else { + LOG(LS_INFO) << "Allocate ports on "<< networks.size() << " networks"; PortConfiguration* config = configs_.empty() ? nullptr : configs_.back(); for (uint32_t i = 0; i < networks.size(); ++i) { uint32_t sequence_flags = flags(); @@ -585,17 +589,12 @@ void BasicPortAllocatorSession::DoAllocate() { AllocationSequence* sequence = new AllocationSequence(this, networks[i], config, sequence_flags); - if (!sequence->Init()) { - delete sequence; - continue; - } - done_signal_needed = true; sequence->SignalPortAllocationComplete.connect( this, &BasicPortAllocatorSession::OnPortAllocationComplete); - if (!IsStopped()) { - sequence->Start(); - } + sequence->Init(); + sequence->Start(); sequences_.push_back(sequence); + done_signal_needed = true; } } if (done_signal_needed) { @@ -618,7 +617,10 @@ void BasicPortAllocatorSession::OnNetworksChanged() { } RemovePortsAndCandidates(failed_networks); - network_manager_started_ = true; + if (!network_manager_started_) { + LOG(LS_INFO) << "Network manager is started"; + network_manager_started_ = true; + } if (allocation_started_) DoAllocate(); } @@ -986,7 +988,7 @@ AllocationSequence::AllocationSequence(BasicPortAllocatorSession* session, phase_(0) { } -bool AllocationSequence::Init() { +void AllocationSequence::Init() { if (IsFlagSet(PORTALLOCATOR_ENABLE_SHARED_SOCKET)) { udp_socket_.reset(session_->socket_factory()->CreateUdpSocket( rtc::SocketAddress(ip_, 0), session_->allocator()->min_port(), @@ -998,7 +1000,6 @@ bool AllocationSequence::Init() { // Continuing if |udp_socket_| is NULL, as local TCP and RelayPort using TCP // are next available options to setup a communication channel. } - return true; } void AllocationSequence::Clear() { diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h index ebba4db65b..204ff040a1 100644 --- a/webrtc/p2p/client/basicportallocator.h +++ b/webrtc/p2p/client/basicportallocator.h @@ -288,7 +288,7 @@ class AllocationSequence : public rtc::MessageHandler, PortConfiguration* config, uint32_t flags); ~AllocationSequence(); - bool Init(); + void Init(); void Clear(); void OnNetworkFailed();