Add thread guard for DcSctpTransport::ready_to_send_data_

Bug: none
Change-Id: Ib141122bf449ac4e2b9f3adfb7fb6af38d18d785
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298621
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39638}
This commit is contained in:
Tommi 2023-03-21 20:29:16 +01:00 committed by WebRTC LUCI CQ
parent bbc926d62c
commit 72b12a935e
2 changed files with 3 additions and 1 deletions

View File

@ -349,6 +349,7 @@ RTCError DcSctpTransport::SendData(int sid,
}
bool DcSctpTransport::ReadyToSendData() {
RTC_DCHECK_RUN_ON(network_thread_);
return ready_to_send_data_;
}
@ -511,6 +512,7 @@ void DcSctpTransport::OnConnected() {
}
void DcSctpTransport::OnClosed() {
RTC_DCHECK_RUN_ON(network_thread_);
RTC_DLOG(LS_INFO) << debug_name_ << "->OnClosed().";
ready_to_send_data_ = false;
}

View File

@ -131,7 +131,7 @@ class DcSctpTransport : public cricket::SctpTransportInternal,
// Map of all currently open or closing data channels
flat_map<dcsctp::StreamID, StreamState> stream_states_
RTC_GUARDED_BY(network_thread_);
bool ready_to_send_data_ = false;
bool ready_to_send_data_ RTC_GUARDED_BY(network_thread_) = false;
std::function<void()> on_connected_callback_ RTC_GUARDED_BY(network_thread_);
DataChannelSink* data_channel_sink_ RTC_GUARDED_BY(network_thread_) = nullptr;
};