Remove SctpDataChannel::writable_
This flag isn't needed for sctp data channels. Bug: none Change-Id: I07b8ba2c5186729b8a5edb4d2bba7b800335ab5d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299074 Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39701}
This commit is contained in:
parent
d32e5b3078
commit
e08f9a94fa
@ -117,10 +117,6 @@ bool InternalDataChannelInit::IsValid() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SctpSidAllocator::SctpSidAllocator() {
|
|
||||||
sequence_checker_.Detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamId SctpSidAllocator::AllocateSid(rtc::SSLRole role) {
|
StreamId SctpSidAllocator::AllocateSid(rtc::SSLRole role) {
|
||||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||||
int potential_sid = (role == rtc::SSL_CLIENT) ? 0 : 1;
|
int potential_sid = (role == rtc::SSL_CLIENT) ? 0 : 1;
|
||||||
@ -389,9 +385,7 @@ void SctpDataChannel::OnTransportChannelCreated() {
|
|||||||
|
|
||||||
connected_to_transport_ = true;
|
connected_to_transport_ = true;
|
||||||
|
|
||||||
// The sid may have been unassigned when controller_->ConnectDataChannel was
|
if (id_.HasValue()) {
|
||||||
// done. So always add the streams even if connected_to_transport_ is true.
|
|
||||||
if (id_.HasValue() && connected_to_transport_) {
|
|
||||||
network_thread_->BlockingCall(
|
network_thread_->BlockingCall(
|
||||||
[c = controller_.get(), sid = id_] { c->AddSctpDataStream(sid); });
|
[c = controller_.get(), sid = id_] { c->AddSctpDataStream(sid); });
|
||||||
}
|
}
|
||||||
@ -475,9 +469,7 @@ void SctpDataChannel::OnDataReceived(DataMessageType type,
|
|||||||
void SctpDataChannel::OnTransportReady() {
|
void SctpDataChannel::OnTransportReady() {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
|
|
||||||
// TODO(tommi, hta): We don't need the `writable_` flag for SCTP datachannels.
|
// TODO(bugs.webrtc.org/11547): The transport is configured inside
|
||||||
// Remove it and just rely on `connected_to_transport_` instead.
|
|
||||||
// In practice the transport is configured inside
|
|
||||||
// `PeerConnection::SetupDataChannelTransport_n`, which results in
|
// `PeerConnection::SetupDataChannelTransport_n`, which results in
|
||||||
// `SctpDataChannel` getting the OnTransportChannelCreated callback, and then
|
// `SctpDataChannel` getting the OnTransportChannelCreated callback, and then
|
||||||
// that's immediately followed by calling `transport->SetDataSink` which is
|
// that's immediately followed by calling `transport->SetDataSink` which is
|
||||||
@ -488,7 +480,6 @@ void SctpDataChannel::OnTransportReady() {
|
|||||||
// be on for the below `Send*` calls, which currently do a BlockingCall
|
// be on for the below `Send*` calls, which currently do a BlockingCall
|
||||||
// from the signaling thread to the network thread.
|
// from the signaling thread to the network thread.
|
||||||
RTC_DCHECK(connected_to_transport_);
|
RTC_DCHECK(connected_to_transport_);
|
||||||
writable_ = true;
|
|
||||||
|
|
||||||
SendQueuedControlMessages();
|
SendQueuedControlMessages();
|
||||||
SendQueuedDataMessages();
|
SendQueuedDataMessages();
|
||||||
@ -544,8 +535,8 @@ void SctpDataChannel::UpdateState() {
|
|||||||
WriteDataChannelOpenAckMessage(&payload);
|
WriteDataChannelOpenAckMessage(&payload);
|
||||||
SendControlMessage(payload);
|
SendControlMessage(payload);
|
||||||
}
|
}
|
||||||
if (writable_ && (handshake_state_ == kHandshakeReady ||
|
if (handshake_state_ == kHandshakeReady ||
|
||||||
handshake_state_ == kHandshakeWaitingForAck)) {
|
handshake_state_ == kHandshakeWaitingForAck) {
|
||||||
SetState(kOpen);
|
SetState(kOpen);
|
||||||
// If we have received buffers before the channel got writable.
|
// If we have received buffers before the channel got writable.
|
||||||
// Deliver them now.
|
// Deliver them now.
|
||||||
@ -717,7 +708,6 @@ void SctpDataChannel::QueueControlMessage(
|
|||||||
|
|
||||||
bool SctpDataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
|
bool SctpDataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
|
||||||
RTC_DCHECK_RUN_ON(signaling_thread_);
|
RTC_DCHECK_RUN_ON(signaling_thread_);
|
||||||
RTC_DCHECK(writable_);
|
|
||||||
RTC_DCHECK(connected_to_transport_);
|
RTC_DCHECK(connected_to_transport_);
|
||||||
RTC_DCHECK(id_.HasValue());
|
RTC_DCHECK(id_.HasValue());
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ struct InternalDataChannelInit : public DataChannelInit {
|
|||||||
// Helper class to allocate unique IDs for SCTP DataChannels.
|
// Helper class to allocate unique IDs for SCTP DataChannels.
|
||||||
class SctpSidAllocator {
|
class SctpSidAllocator {
|
||||||
public:
|
public:
|
||||||
SctpSidAllocator();
|
SctpSidAllocator() = default;
|
||||||
// Gets the first unused odd/even id based on the DTLS role. If `role` is
|
// Gets the first unused odd/even id based on the DTLS role. If `role` is
|
||||||
// SSL_CLIENT, the allocated id starts from 0 and takes even numbers;
|
// SSL_CLIENT, the allocated id starts from 0 and takes even numbers;
|
||||||
// otherwise, the id starts from 1 and takes odd numbers.
|
// otherwise, the id starts from 1 and takes odd numbers.
|
||||||
@ -101,7 +101,8 @@ class SctpSidAllocator {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
flat_set<StreamId> used_sids_ RTC_GUARDED_BY(&sequence_checker_);
|
flat_set<StreamId> used_sids_ RTC_GUARDED_BY(&sequence_checker_);
|
||||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_;
|
RTC_NO_UNIQUE_ADDRESS SequenceChecker sequence_checker_{
|
||||||
|
SequenceChecker::kDetached};
|
||||||
};
|
};
|
||||||
|
|
||||||
// SctpDataChannel is an implementation of the DataChannelInterface based on
|
// SctpDataChannel is an implementation of the DataChannelInterface based on
|
||||||
@ -278,7 +279,6 @@ class SctpDataChannel : public DataChannelInterface {
|
|||||||
HandshakeState handshake_state_ RTC_GUARDED_BY(signaling_thread_) =
|
HandshakeState handshake_state_ RTC_GUARDED_BY(signaling_thread_) =
|
||||||
kHandshakeInit;
|
kHandshakeInit;
|
||||||
bool connected_to_transport_ RTC_GUARDED_BY(signaling_thread_) = false;
|
bool connected_to_transport_ RTC_GUARDED_BY(signaling_thread_) = false;
|
||||||
bool writable_ RTC_GUARDED_BY(signaling_thread_) = false;
|
|
||||||
// Did we already start the graceful SCTP closing procedure?
|
// Did we already start the graceful SCTP closing procedure?
|
||||||
bool started_closing_procedure_ RTC_GUARDED_BY(signaling_thread_) = false;
|
bool started_closing_procedure_ RTC_GUARDED_BY(signaling_thread_) = false;
|
||||||
// Control messages that always have to get sent out before any queued
|
// Control messages that always have to get sent out before any queued
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user