From 54f1d9bafd6691f2f207c879e013f16f4d296f30 Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Fri, 20 May 2016 15:37:51 -0700 Subject: [PATCH] Removing PORTALLOCATOR_ENABLE_SHAKER. It's not used by anything, and is obsoleted by connection pruning, candidate pruning, timeouts, etc. R=pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/1992253005 . Cr-Commit-Position: refs/heads/master@{#12834} --- webrtc/p2p/base/portallocator.h | 1 - webrtc/p2p/client/basicportallocator.cc | 49 ------------------------- webrtc/p2p/client/basicportallocator.h | 1 - 3 files changed, 51 deletions(-) diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h index 879657081a..89a0e0aae8 100644 --- a/webrtc/p2p/base/portallocator.h +++ b/webrtc/p2p/base/portallocator.h @@ -40,7 +40,6 @@ enum { // Disable local TCP ports. This doesn't impact how we connect to relay // servers. PORTALLOCATOR_DISABLE_TCP = 0x08, - PORTALLOCATOR_ENABLE_SHAKER = 0x10, PORTALLOCATOR_ENABLE_IPV6 = 0x40, // TODO(pthatcher): Remove this once it's no longer used in: // remoting/client/plugin/pepper_port_allocator.cc diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc index 143b036183..bf61bc88fc 100644 --- a/webrtc/p2p/client/basicportallocator.cc +++ b/webrtc/p2p/client/basicportallocator.cc @@ -36,7 +36,6 @@ enum { MSG_CONFIG_READY, MSG_ALLOCATE, MSG_ALLOCATION_PHASE, - MSG_SHAKE, MSG_SEQUENCEOBJECTS_CREATED, MSG_CONFIG_STOP, }; @@ -48,14 +47,6 @@ const int PHASE_SSLTCP = 3; const int kNumPhases = 4; -const int SHAKE_MIN_DELAY = 45 * 1000; // 45 seconds -const int SHAKE_MAX_DELAY = 90 * 1000; // 90 seconds - -int ShakeDelay() { - int range = SHAKE_MAX_DELAY - SHAKE_MIN_DELAY + 1; - return SHAKE_MIN_DELAY + CreateRandomId() % range; -} - } // namespace namespace cricket { @@ -186,9 +177,6 @@ void BasicPortAllocatorSession::StartGettingPorts() { running_ = true; network_thread_->Post(this, MSG_CONFIG_START); - - if (flags() & PORTALLOCATOR_ENABLE_SHAKER) - network_thread_->PostDelayed(ShakeDelay(), this, MSG_SHAKE); } void BasicPortAllocatorSession::StopGettingPorts() { @@ -265,21 +253,14 @@ void BasicPortAllocatorSession::OnMessage(rtc::Message *message) { ASSERT(rtc::Thread::Current() == network_thread_); GetPortConfigurations(); break; - case MSG_CONFIG_READY: ASSERT(rtc::Thread::Current() == network_thread_); OnConfigReady(static_cast(message->pdata)); break; - case MSG_ALLOCATE: ASSERT(rtc::Thread::Current() == network_thread_); OnAllocate(); break; - - case MSG_SHAKE: - ASSERT(rtc::Thread::Current() == network_thread_); - OnShake(); - break; case MSG_SEQUENCEOBJECTS_CREATED: ASSERT(rtc::Thread::Current() == network_thread_); OnAllocationSequenceObjectsCreated(); @@ -713,36 +694,6 @@ void BasicPortAllocatorSession::OnPortDestroyed( ASSERT(false); } -void BasicPortAllocatorSession::OnShake() { - LOG(INFO) << ">>>>> SHAKE <<<<< >>>>> SHAKE <<<<< >>>>> SHAKE <<<<<"; - - std::vector ports; - std::vector connections; - - for (size_t i = 0; i < ports_.size(); ++i) { - if (ports_[i].ready()) - ports.push_back(ports_[i].port()); - } - - for (size_t i = 0; i < ports.size(); ++i) { - Port::AddressMap::const_iterator iter; - for (iter = ports[i]->connections().begin(); - iter != ports[i]->connections().end(); - ++iter) { - connections.push_back(iter->second); - } - } - - LOG(INFO) << ">>>>> Destroying " << ports.size() << " ports and " - << connections.size() << " connections"; - - for (size_t i = 0; i < connections.size(); ++i) - connections[i]->Destroy(); - - if (running_ || (ports.size() > 0) || (connections.size() > 0)) - network_thread_->PostDelayed(ShakeDelay(), this, MSG_SHAKE); -} - BasicPortAllocatorSession::PortData* BasicPortAllocatorSession::FindPort( Port* port) { for (std::vector::iterator it = ports_.begin(); diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h index fd189c14e9..6a719c73bd 100644 --- a/webrtc/p2p/client/basicportallocator.h +++ b/webrtc/p2p/client/basicportallocator.h @@ -162,7 +162,6 @@ class BasicPortAllocatorSession : public PortAllocatorSession, void OnPortError(Port* port); void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto); void OnPortDestroyed(PortInterface* port); - void OnShake(); void MaybeSignalCandidatesAllocationDone(); void OnPortAllocationComplete(AllocationSequence* seq); PortData* FindPort(Port* port);