refactor(client): index pending probe deadlines
This commit is contained in:
2 files changed
+220
-18
No files matched your search
@@ -1803,6 +1803,34 @@ mod tests {
|
||||
assert_eq!(active(&machine).pending.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exhaustive_timeout_polling_returns_every_due_loss() {
|
||||
let mut machine = open_machine(4, Duration::from_secs(1));
|
||||
let now = Instant::now();
|
||||
for seq in [2, 0, 1] {
|
||||
let sent_at = timestamp(now - Duration::from_secs(u64::from(seq) + 1));
|
||||
let session = active_mut(&mut machine);
|
||||
session.pending.preflight_insert(seq).unwrap();
|
||||
session.pending.commit_insert(PendingProbe {
|
||||
wire_seq: seq,
|
||||
sent_at,
|
||||
timeout_at: now,
|
||||
});
|
||||
}
|
||||
|
||||
let events = machine.poll_timeouts_at(now).unwrap();
|
||||
assert!(matches!(
|
||||
events.as_slice(),
|
||||
[
|
||||
ClientEvent::EchoLoss { seq: 2, .. },
|
||||
ClientEvent::EchoLoss { seq: 1, .. },
|
||||
ClientEvent::EchoLoss { seq: 0, .. },
|
||||
]
|
||||
));
|
||||
assert_eq!(active(&machine).pending.len(), 0);
|
||||
assert_eq!(active(&machine).timed_out.len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrapping_sequence_from_max_to_zero_remains_valid() {
|
||||
let mut machine = open_machine(2, Duration::from_secs(1));
|
||||
|
||||
Reference in new issue
Block a user