pub struct AcknowledgmentHandler { /* private fields */ }Expand description
Responsible for handling the acknowledgment of packets.
Implementations§
Source§impl AcknowledgmentHandler
impl AcknowledgmentHandler
Sourcepub fn with_congestion(congestion: CongestionControl) -> Self
pub fn with_congestion(congestion: CongestionControl) -> Self
Creates a new acknowledgment handler with custom congestion control.
Sourcepub fn packets_in_flight(&self) -> u16
pub fn packets_in_flight(&self) -> u16
Returns the number of sent packets not yet acknowledged.
Sourcepub fn local_sequence_num(&self) -> SequenceNumber
pub fn local_sequence_num(&self) -> SequenceNumber
Returns the local sequence number for the next outgoing packet.
Sourcepub fn remote_sequence_num(&self) -> SequenceNumber
pub fn remote_sequence_num(&self) -> SequenceNumber
Returns the most recent remote sequence number received.
Sourcepub fn congestion(&self) -> &CongestionControl
pub fn congestion(&self) -> &CongestionControl
Returns a reference to the congestion control.
Sourcepub fn congestion_mut(&mut self) -> &mut CongestionControl
pub fn congestion_mut(&mut self) -> &mut CongestionControl
Returns a mutable reference to the congestion control.
Sourcepub fn update_throttle(&mut self, now: Instant) -> bool
pub fn update_throttle(&mut self, now: Instant) -> bool
Updates the dynamic throttle based on current network conditions.
Sourcepub fn should_drop_unreliable(&self) -> bool
pub fn should_drop_unreliable(&self) -> bool
Returns whether an unreliable packet should be dropped based on congestion.
Sourcepub fn ack_bitfield(&self) -> u32
pub fn ack_bitfield(&self) -> u32
Returns the acknowledgment bitfield for the last 32 packets.
Sourcepub fn process_incoming(
&mut self,
remote_seq_num: u16,
remote_ack_seq: u16,
remote_ack_field: u32,
now: Instant,
)
pub fn process_incoming( &mut self, remote_seq_num: u16, remote_ack_seq: u16, remote_ack_field: u32, now: Instant, )
Processes an incoming packet and updates congestion metrics. Calculates RTT when ACKs are received.
Sourcepub fn process_outgoing(
&mut self,
packet_type: PacketType,
payload: &[u8],
ordering_guarantee: OrderingGuarantee,
item_identifier: Option<SequenceNumber>,
now: Instant,
)
pub fn process_outgoing( &mut self, packet_type: PacketType, payload: &[u8], ordering_guarantee: OrderingGuarantee, item_identifier: Option<SequenceNumber>, now: Instant, )
Processes an outgoing packet and tracks it for acknowledgment.
Sourcepub fn dropped_packets(&mut self) -> Vec<SentPacket>
pub fn dropped_packets(&mut self) -> Vec<SentPacket>
Returns packets that are considered dropped (not ACKed beyond window). Records packet loss for congestion control.
A packet is considered dropped if it is more than REDUNDANT_PACKET_ACKS_SIZE (32) sequence numbers behind the latest acknowledged sequence number.