From df3e4caf77aeb38ded155fed90d074b0b4244638 Mon Sep 17 00:00:00 2001 From: Tommi Date: Wed, 15 Mar 2023 14:35:39 +0100 Subject: [PATCH] Remove SctpDataChannelControllerInterface::DisconnectDataChannel Bug: webrtc:11547 Change-Id: Ibc8c64da5289d5cb8c8a777cd0e764f71eb14fa7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/297361 Commit-Queue: Harald Alvestrand Auto-Submit: Tomas Gunnarsson Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/main@{#39565} --- pc/data_channel_controller.cc | 7 ------- pc/data_channel_controller.h | 1 - pc/sctp_data_channel.cc | 2 -- pc/sctp_data_channel.h | 2 -- pc/test/fake_data_channel_controller.h | 10 ++-------- 5 files changed, 2 insertions(+), 20 deletions(-) diff --git a/pc/data_channel_controller.cc b/pc/data_channel_controller.cc index 7ce2fd74f0..9cbbc58fd8 100644 --- a/pc/data_channel_controller.cc +++ b/pc/data_channel_controller.cc @@ -46,13 +46,6 @@ bool DataChannelController::ConnectDataChannel( return data_channel_transport() ? true : false; } -void DataChannelController::DisconnectDataChannel( - SctpDataChannel* webrtc_data_channel) { - RTC_DCHECK_RUN_ON(signaling_thread()); - // TODO(bugs.webrtc.org/11547): This method can be removed once not - // needed by `SctpDataChannel`. -} - void DataChannelController::AddSctpDataStream(int sid) { if (data_channel_transport()) { network_thread()->BlockingCall([this, sid] { diff --git a/pc/data_channel_controller.h b/pc/data_channel_controller.h index 4cca379644..8427656ec6 100644 --- a/pc/data_channel_controller.h +++ b/pc/data_channel_controller.h @@ -52,7 +52,6 @@ class DataChannelController : public SctpDataChannelControllerInterface, const rtc::CopyOnWriteBuffer& payload, cricket::SendDataResult* result) override; bool ConnectDataChannel(SctpDataChannel* webrtc_data_channel) override; - void DisconnectDataChannel(SctpDataChannel* webrtc_data_channel) override; void AddSctpDataStream(int sid) override; void RemoveSctpDataStream(int sid) override; bool ReadyToSendData() const override; diff --git a/pc/sctp_data_channel.cc b/pc/sctp_data_channel.cc index dad00f2446..9c8be692bc 100644 --- a/pc/sctp_data_channel.cc +++ b/pc/sctp_data_channel.cc @@ -391,7 +391,6 @@ void SctpDataChannel::OnClosingProcedureComplete() { // all pending data and transitioned to kClosing already. RTC_DCHECK_EQ(state_, kClosing); RTC_DCHECK(queued_send_data_.Empty()); - SetState(kClosed); } @@ -608,7 +607,6 @@ void SctpDataChannel::DisconnectFromTransport() { if (!connected_to_transport_ || !controller_) return; - controller_->DisconnectDataChannel(this); connected_to_transport_ = false; } diff --git a/pc/sctp_data_channel.h b/pc/sctp_data_channel.h index be34f3a6ef..cdd7ca6fa2 100644 --- a/pc/sctp_data_channel.h +++ b/pc/sctp_data_channel.h @@ -47,8 +47,6 @@ class SctpDataChannelControllerInterface { cricket::SendDataResult* result) = 0; // Connects to the transport signals. virtual bool ConnectDataChannel(SctpDataChannel* data_channel) = 0; - // Disconnects from the transport signals. - virtual void DisconnectDataChannel(SctpDataChannel* data_channel) = 0; // Adds the data channel SID to the transport for SCTP. virtual void AddSctpDataStream(int sid) = 0; // Begins the closing procedure by sending an outgoing stream reset. Still diff --git a/pc/test/fake_data_channel_controller.h b/pc/test/fake_data_channel_controller.h index b0c16b7f52..d4acf9240b 100644 --- a/pc/test/fake_data_channel_controller.h +++ b/pc/test/fake_data_channel_controller.h @@ -63,13 +63,6 @@ class FakeDataChannelController return true; } - void DisconnectDataChannel(webrtc::SctpDataChannel* data_channel) override { - RTC_CHECK(connected_channels_.find(data_channel) != - connected_channels_.end()); - RTC_LOG(LS_VERBOSE) << "DataChannel disconnected " << data_channel; - connected_channels_.erase(data_channel); - } - void AddSctpDataStream(int sid) override { RTC_CHECK(sid >= 0); if (!transport_available_) { @@ -90,8 +83,8 @@ class FakeDataChannelController if (connected_channels_.count(ch) && ch->id() == sid) { // This path mimics the DCC's OnChannelClosed handler since the FDCC // (this class) doesn't have a transport that would do that. - DisconnectDataChannel(ch); ch->OnClosingProcedureComplete(); + return; } } } @@ -105,6 +98,7 @@ class FakeDataChannelController ++channels_opened_; } else if (state == webrtc::DataChannelInterface::DataState::kClosed) { ++channels_closed_; + connected_channels_.erase(data_channel); } }