diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc')
-rw-r--r-- | third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc b/third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc index 0621b48e80..c6c8861e1f 100644 --- a/third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc +++ b/third_party/libwebrtc/net/dcsctp/socket/transmission_control_block.cc @@ -17,6 +17,7 @@ #include <vector> #include "absl/types/optional.h" +#include "api/units/time_delta.h" #include "net/dcsctp/packet/chunk/data_chunk.h" #include "net/dcsctp/packet/chunk/forward_tsn_chunk.h" #include "net/dcsctp/packet/chunk/idata_chunk.h" @@ -37,6 +38,8 @@ #include "rtc_base/strings/string_builder.h" namespace dcsctp { +using ::webrtc::TimeDelta; +using ::webrtc::Timestamp; TransmissionControlBlock::TransmissionControlBlock( TimerManager& timer_manager, @@ -61,20 +64,20 @@ TransmissionControlBlock::TransmissionControlBlock( t3_rtx_(timer_manager_.CreateTimer( "t3-rtx", absl::bind_front(&TransmissionControlBlock::OnRtxTimerExpiry, this), - TimerOptions(options.rto_initial, + TimerOptions(options.rto_initial.ToTimeDelta(), TimerBackoffAlgorithm::kExponential, /*max_restarts=*/absl::nullopt, options.max_timer_backoff_duration.has_value() - ? *options.max_timer_backoff_duration - : DurationMs::InfiniteDuration()))), + ? options.max_timer_backoff_duration->ToTimeDelta() + : TimeDelta::PlusInfinity()))), delayed_ack_timer_(timer_manager_.CreateTimer( "delayed-ack", absl::bind_front(&TransmissionControlBlock::OnDelayedAckTimerExpiry, this), - TimerOptions(options.delayed_ack_max_timeout, + TimerOptions(options.delayed_ack_max_timeout.ToTimeDelta(), TimerBackoffAlgorithm::kExponential, /*max_restarts=*/0, - /*max_backoff_duration=*/DurationMs::InfiniteDuration(), + /*max_backoff_duration=*/TimeDelta::PlusInfinity(), webrtc::TaskQueueBase::DelayPrecision::kHigh))), my_verification_tag_(my_verification_tag), my_initial_tsn_(my_initial_tsn), @@ -112,21 +115,22 @@ TransmissionControlBlock::TransmissionControlBlock( send_queue.EnableMessageInterleaving(capabilities.message_interleaving); } -void TransmissionControlBlock::ObserveRTT(DurationMs rtt) { - DurationMs prev_rto = rto_.rto(); +void TransmissionControlBlock::ObserveRTT(TimeDelta rtt) { + TimeDelta prev_rto = rto_.rto(); rto_.ObserveRTT(rtt); - RTC_DLOG(LS_VERBOSE) << log_prefix_ << "new rtt=" << *rtt - << ", srtt=" << *rto_.srtt() << ", rto=" << *rto_.rto() - << " (" << *prev_rto << ")"; + RTC_DLOG(LS_VERBOSE) << log_prefix_ << "new rtt=" << webrtc::ToString(rtt) + << ", srtt=" << webrtc::ToString(rto_.srtt()) + << ", rto=" << webrtc::ToString(rto_.rto()) << " (" + << webrtc::ToString(prev_rto) << ")"; t3_rtx_->set_duration(rto_.rto()); - DurationMs delayed_ack_tmo = - std::min(rto_.rto() * 0.5, options_.delayed_ack_max_timeout); + TimeDelta delayed_ack_tmo = std::min( + rto_.rto() * 0.5, options_.delayed_ack_max_timeout.ToTimeDelta()); delayed_ack_timer_->set_duration(delayed_ack_tmo); } -absl::optional<DurationMs> TransmissionControlBlock::OnRtxTimerExpiry() { - TimeMs now = callbacks_.TimeMillis(); +TimeDelta TransmissionControlBlock::OnRtxTimerExpiry() { + Timestamp now = callbacks_.Now(); RTC_DLOG(LS_INFO) << log_prefix_ << "Timer " << t3_rtx_->name() << " has expired"; if (cookie_echo_chunk_.has_value()) { @@ -139,13 +143,13 @@ absl::optional<DurationMs> TransmissionControlBlock::OnRtxTimerExpiry() { SendBufferedPackets(now); } } - return absl::nullopt; + return TimeDelta::Zero(); } -absl::optional<DurationMs> TransmissionControlBlock::OnDelayedAckTimerExpiry() { +TimeDelta TransmissionControlBlock::OnDelayedAckTimerExpiry() { data_tracker_.HandleDelayedAckTimerExpiry(); MaybeSendSack(); - return absl::nullopt; + return TimeDelta::Zero(); } void TransmissionControlBlock::MaybeSendSack() { @@ -158,7 +162,7 @@ void TransmissionControlBlock::MaybeSendSack() { } void TransmissionControlBlock::MaybeSendForwardTsn(SctpPacket::Builder& builder, - TimeMs now) { + Timestamp now) { if (now >= limit_forward_tsn_until_ && retransmission_queue_.ShouldSendForwardTsn(now)) { if (capabilities_.message_interleaving) { @@ -173,7 +177,8 @@ void TransmissionControlBlock::MaybeSendForwardTsn(SctpPacket::Builder& builder, // sending a duplicate FORWARD TSN." // "Any delay applied to the sending of FORWARD TSN chunk SHOULD NOT exceed // 200ms and MUST NOT exceed 500ms". - limit_forward_tsn_until_ = now + std::min(DurationMs(200), rto_.srtt()); + limit_forward_tsn_until_ = + now + std::min(TimeDelta::Millis(200), rto_.srtt()); } } @@ -205,7 +210,7 @@ void TransmissionControlBlock::MaybeSendFastRetransmit() { } void TransmissionControlBlock::SendBufferedPackets(SctpPacket::Builder& builder, - TimeMs now) { + Timestamp now) { for (int packet_idx = 0; packet_idx < options_.max_burst && retransmission_queue_.can_send_data(); ++packet_idx) { |