dcsctp: Fix accidental re-use of variable
This was caused by change 231229 and was later caught when reviewing the code. The rtt variable was accidentally re-used for another purpose, and then assumed to still be used to represent the rtt. There have been no issues found with this re-use, but it was wrong. Bug: webrtc:12614 Change-Id: If1a180315cf833e293f78c54c3c3b29394a19a20 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232610 Reviewed-by: Florent Castelli <orphis@webrtc.org> Commit-Queue: Victor Boivie <boivie@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35064}
This commit is contained in:
parent
9def99487e
commit
7d7afc6468
@ -23,7 +23,7 @@ RetransmissionTimeout::RetransmissionTimeout(const DcSctpOptions& options)
|
||||
rto_(*options.rto_initial) {}
|
||||
|
||||
void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) {
|
||||
int32_t rtt = *measured_rtt;
|
||||
const int32_t rtt = *measured_rtt;
|
||||
|
||||
// Unrealistic values will be skipped. If a wrongly measured (or otherwise
|
||||
// corrupt) value was processed, it could change the state in a way that would
|
||||
@ -40,13 +40,13 @@ void RetransmissionTimeout::ObserveRTT(DurationMs measured_rtt) {
|
||||
scaled_rtt_var_ = (rtt / 2) << kRttVarShift;
|
||||
first_measurement_ = false;
|
||||
} else {
|
||||
rtt -= (scaled_srtt_ >> kRttShift);
|
||||
scaled_srtt_ += rtt;
|
||||
if (rtt < 0) {
|
||||
rtt = -rtt;
|
||||
int32_t rtt_diff = rtt - (scaled_srtt_ >> kRttShift);
|
||||
scaled_srtt_ += rtt_diff;
|
||||
if (rtt_diff < 0) {
|
||||
rtt_diff = -rtt_diff;
|
||||
}
|
||||
rtt -= (scaled_rtt_var_ >> kRttVarShift);
|
||||
scaled_rtt_var_ += rtt;
|
||||
rtt_diff -= (scaled_rtt_var_ >> kRttVarShift);
|
||||
scaled_rtt_var_ += rtt_diff;
|
||||
}
|
||||
rto_ = (scaled_srtt_ >> kRttShift) + scaled_rtt_var_;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user