pub struct SackScoreboard { /* private fields */ }Expand description
Tracks selectively acknowledged ranges for a TCP connection.
Maintains a sorted, non-overlapping list of SACK blocks representing data the remote receiver has confirmed receiving out of order.
Implementations§
Source§impl SackScoreboard
impl SackScoreboard
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Returns the number of tracked SACK blocks.
Sourcepub fn is_sacked(&self, seq: u32) -> bool
pub fn is_sacked(&self, seq: u32) -> bool
Returns true if the given sequence number falls within a SACKed range.
Sourcepub fn mark_sacked(&mut self, left: u32, right: u32)
pub fn mark_sacked(&mut self, left: u32, right: u32)
Mark a range [left, right) as selectively acknowledged.
Merges with any overlapping or adjacent existing blocks to maintain the invariant that blocks are sorted and non-overlapping.
Sourcepub fn clear_below(&mut self, ack: u32)
pub fn clear_below(&mut self, ack: u32)
Remove all blocks (or portions) below the cumulative ACK.
Data below ack has been cumulatively acknowledged, so SACK
blocks covering that range are no longer needed.
Sourcepub fn highest_sacked(&self) -> Option<u32>
pub fn highest_sacked(&self) -> Option<u32>
Returns the highest SACKed sequence number, or None if empty.
Sourcepub fn next_retransmit(&self, snd_una: u32) -> Option<(u32, u32)>
pub fn next_retransmit(&self, snd_una: u32) -> Option<(u32, u32)>
Returns the next hole (gap) that needs retransmission.
Starting from snd_una (send unacknowledged), finds the first
gap between SACK blocks. Returns (start_seq, length) of the hole.