From 0666a9b28bfbf8ff81ff2183c9463e277998fabc Mon Sep 17 00:00:00 2001 From: Peter Thatcher Date: Thu, 9 Apr 2015 17:45:10 -0700 Subject: [PATCH] Remove Transport::Reset, which is never used, and only makes reading the code harder. R=guoweis@webrtc.org Review URL: https://webrtc-codereview.appspot.com/43049004 Cr-Commit-Position: refs/heads/master@{#8965} --- webrtc/p2p/base/dtlstransportchannel.cc | 15 ----------- webrtc/p2p/base/dtlstransportchannel.h | 1 - webrtc/p2p/base/p2ptransportchannel.cc | 33 ------------------------- webrtc/p2p/base/p2ptransportchannel.h | 1 - webrtc/p2p/base/transport.cc | 19 -------------- webrtc/p2p/base/transportchannelimpl.h | 3 --- 6 files changed, 72 deletions(-) diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc index 3344bffe2..6c853c14f 100644 --- a/webrtc/p2p/base/dtlstransportchannel.cc +++ b/webrtc/p2p/base/dtlstransportchannel.cc @@ -121,21 +121,6 @@ void DtlsTransportChannelWrapper::Connect() { channel_->Connect(); } -void DtlsTransportChannelWrapper::Reset() { - channel_->Reset(); - set_writable(false); - set_readable(false); - - // Re-call SetupDtls() - if (!SetupDtls()) { - LOG_J(LS_ERROR, this) << "Error re-initializing DTLS"; - dtls_state_ = STATE_CLOSED; - return; - } - - dtls_state_ = STATE_ACCEPTED; -} - bool DtlsTransportChannelWrapper::SetLocalIdentity( rtc::SSLIdentity* identity) { if (dtls_state_ != STATE_NONE) { diff --git a/webrtc/p2p/base/dtlstransportchannel.h b/webrtc/p2p/base/dtlstransportchannel.h index 03a916b76..a5fd03526 100644 --- a/webrtc/p2p/base/dtlstransportchannel.h +++ b/webrtc/p2p/base/dtlstransportchannel.h @@ -204,7 +204,6 @@ class DtlsTransportChannelWrapper : public TransportChannelImpl { } virtual void Connect(); - virtual void Reset(); virtual void OnSignalingReady() { channel_->OnSignalingReady(); diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc index bca2c450c..ef2155962 100644 --- a/webrtc/p2p/base/p2ptransportchannel.cc +++ b/webrtc/p2p/base/p2ptransportchannel.cc @@ -371,39 +371,6 @@ void P2PTransportChannel::Connect() { thread()->Post(this, MSG_PING); } -// Reset the socket, clear up any previous allocations and start over -void P2PTransportChannel::Reset() { - ASSERT(worker_thread_ == rtc::Thread::Current()); - - // Get rid of all the old allocators. This should clean up everything. - for (uint32 i = 0; i < allocator_sessions_.size(); ++i) - delete allocator_sessions_[i]; - - allocator_sessions_.clear(); - ports_.clear(); - connections_.clear(); - best_connection_ = NULL; - - // Forget about all of the candidates we got before. - remote_candidates_.clear(); - - // Revert to the initial state. - set_readable(false); - set_writable(false); - - // Reinitialize the rest of our state. - waiting_for_signaling_ = false; - sort_dirty_ = false; - - // If we allocated before, start a new one now. - if (transport_->connect_requested()) - Allocate(); - - // Start pinging as the ports come in. - thread()->Clear(this); - thread()->Post(this, MSG_PING); -} - // A new port is available, attempt to make connections for it void P2PTransportChannel::OnPortReady(PortAllocatorSession *session, PortInterface* port) { diff --git a/webrtc/p2p/base/p2ptransportchannel.h b/webrtc/p2p/base/p2ptransportchannel.h index a9312b7e0..a014701f1 100644 --- a/webrtc/p2p/base/p2ptransportchannel.h +++ b/webrtc/p2p/base/p2ptransportchannel.h @@ -71,7 +71,6 @@ class P2PTransportChannel : public TransportChannelImpl, const std::string& ice_pwd); virtual void SetRemoteIceMode(IceMode mode); virtual void Connect(); - virtual void Reset(); virtual void OnSignalingReady(); virtual void OnCandidate(const Candidate& candidate); diff --git a/webrtc/p2p/base/transport.cc b/webrtc/p2p/base/transport.cc index 10a069683..dfc7d34b4 100644 --- a/webrtc/p2p/base/transport.cc +++ b/webrtc/p2p/base/transport.cc @@ -380,25 +380,6 @@ void Transport::DestroyAllChannels_w() { DestroyTransportChannel(impls[i]); } -void Transport::ResetChannels() { - ASSERT(signaling_thread()->IsCurrent()); - worker_thread_->Invoke(Bind(&Transport::ResetChannels_w, this)); -} - -void Transport::ResetChannels_w() { - ASSERT(worker_thread()->IsCurrent()); - - // We are no longer attempting to connect - connect_requested_ = false; - - // Clear out the old messages, they aren't relevant - rtc::CritScope cs(&crit_); - ready_candidates_.clear(); - - // Reset all of the channels - CallChannels_w(&TransportChannelImpl::Reset); -} - void Transport::OnSignalingReady() { ASSERT(signaling_thread()->IsCurrent()); if (destroyed_) return; diff --git a/webrtc/p2p/base/transportchannelimpl.h b/webrtc/p2p/base/transportchannelimpl.h index db62c9aea..f57b76e33 100644 --- a/webrtc/p2p/base/transportchannelimpl.h +++ b/webrtc/p2p/base/transportchannelimpl.h @@ -55,9 +55,6 @@ class TransportChannelImpl : public TransportChannel { // Begins the process of attempting to make a connection to the other client. virtual void Connect() = 0; - // Resets this channel back to the initial state (i.e., not connecting). - virtual void Reset() = 0; - // Allows an individual channel to request signaling and be notified when it // is ready. This is useful if the individual named channels have need to // send their own transport-info stanzas.