dcsctp: Support unlimited max_retransmissions
The restart limit for timers can already be limitless, but the
RetransmissionErrorCounter didn't support this. With this change, the
max_retransmissions and max_init_retransmits can be absl::nullopt to
indicate that there should be infinite retries.
Bug: webrtc:13129
Change-Id: Ia6e91cccbc2e1bb77b3fdd7f37436290adc2f483
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230701
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34882}
diff --git a/net/dcsctp/timer/timer.h b/net/dcsctp/timer/timer.h
index 2010b23..ed072de 100644
--- a/net/dcsctp/timer/timer.h
+++ b/net/dcsctp/timer/timer.h
@@ -42,10 +42,10 @@
explicit TimerOptions(DurationMs duration)
: TimerOptions(duration, TimerBackoffAlgorithm::kExponential) {}
TimerOptions(DurationMs duration, TimerBackoffAlgorithm backoff_algorithm)
- : TimerOptions(duration, backoff_algorithm, -1) {}
+ : TimerOptions(duration, backoff_algorithm, absl::nullopt) {}
TimerOptions(DurationMs duration,
TimerBackoffAlgorithm backoff_algorithm,
- int max_restarts)
+ absl::optional<int> max_restarts)
: duration(duration),
backoff_algorithm(backoff_algorithm),
max_restarts(max_restarts) {}
@@ -55,8 +55,9 @@
// If the duration should be increased (using exponential backoff) when it is
// restarted. If not set, the same duration will be used.
const TimerBackoffAlgorithm backoff_algorithm;
- // The maximum number of times that the timer will be automatically restarted.
- const int max_restarts;
+ // The maximum number of times that the timer will be automatically restarted,
+ // or absl::nullopt if there is no limit.
+ const absl::optional<int> max_restarts;
};
// A high-level timer (in contrast to the low-level `Timeout` class).