dcsctp: Expire timers just before triggering them
In real life, when a Timeout expires, the caller is supposed to call DcSctpSocket::HandleTimeout directly, as the Timeout that just expired is stopped (it just expired), but the Timer still believes it's running. The system is not in a consistent state. In tests, all timeouts were evaluated at the same time, which, if two timeouts expired at the same time, would put them both as "not running", and with their timers believing they were running. So if you would do any operation on a timer whose timeout had just expired, the timeout would assert saying that "you can't stop a stopped timeout" or similar. This isn't relevant in non-test scenarios. Solved by expiring timeouts one by one. Bug: webrtc:12614 Change-Id: I79d006f4d3e96854d77cec3eb0080aa23b8569cb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217560 Reviewed-by: Florent Castelli <orphis@webrtc.org> Commit-Queue: Victor Boivie <boivie@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33925}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
fc88df81f6
commit
1d2fa9a1c3
@ -32,8 +32,13 @@ class TimerTest : public testing::Test {
|
||||
void AdvanceTimeAndRunTimers(DurationMs duration) {
|
||||
now_ = now_ + duration;
|
||||
|
||||
for (TimeoutID timeout_id : timeout_manager_.RunTimers()) {
|
||||
manager_.HandleTimeout(timeout_id);
|
||||
for (;;) {
|
||||
absl::optional<TimeoutID> timeout_id =
|
||||
timeout_manager_.GetNextExpiredTimeout();
|
||||
if (!timeout_id.has_value()) {
|
||||
break;
|
||||
}
|
||||
manager_.HandleTimeout(*timeout_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user