pub struct LpReliability { /* private fields */ }Expand description
Per-face NDNLPv2 reliability state.
Tracks outbound TxSequences, piggybacked Acks, and adaptive RTO. All methods are synchronous and return wire-ready packets.
Implementations§
Source§impl LpReliability
impl LpReliability
Sourcepub fn from_config(mtu: usize, config: ReliabilityConfig) -> Self
pub fn from_config(mtu: usize, config: ReliabilityConfig) -> Self
Create from a full configuration.
Sourcepub fn apply_config(&mut self, config: ReliabilityConfig)
pub fn apply_config(&mut self, config: ReliabilityConfig)
Apply a new configuration. Resets RTO adaptation state.
Sourcepub fn config(&self) -> ReliabilityConfig
pub fn config(&self) -> ReliabilityConfig
Current configuration (snapshot).
Sourcepub fn on_send(&mut self, pkt: &[u8]) -> Vec<Bytes>
pub fn on_send(&mut self, pkt: &[u8]) -> Vec<Bytes>
Process an outbound packet: fragment if needed, assign TxSequences, piggyback pending Acks, buffer for retransmit.
Returns wire-ready LpPackets.
Sourcepub fn on_receive(&mut self, raw: &[u8])
pub fn on_receive(&mut self, raw: &[u8])
Process an inbound raw LpPacket: extract TxSequence (queue for Ack) and process any piggybacked Acks (clear unacked, measure RTT).
Sourcepub fn check_retransmit(&mut self) -> Vec<Bytes>
pub fn check_retransmit(&mut self) -> Vec<Bytes>
Check for retransmit-eligible entries. Returns wire packets to resend.
Rate-limited to MAX_RETX_PER_TICK to prevent burst retransmissions
from blocking the face_sender (which would starve new packet delivery
and cause throughput collapse).
Sourcepub fn flush_acks(&mut self) -> Option<Bytes>
pub fn flush_acks(&mut self) -> Option<Bytes>
Flush pending Acks as a bare Ack-only LpPacket. Call when the retransmit timer fires and there’s been no recent outgoing traffic.
Sourcepub fn unacked_count(&self) -> usize
pub fn unacked_count(&self) -> usize
Number of unacknowledged packets in flight.