pub struct MultipathReceiver { /* private fields */ }Expand description
A reordering buffer for packets received on multiple paths.
Packets may arrive out of order when using multipath — this buffer holds them and releases them in sequence order.
Implementations§
Source§impl MultipathReceiver
impl MultipathReceiver
Sourcepub fn with_buffer_size(max_buffer: usize) -> Self
pub fn with_buffer_size(max_buffer: usize) -> Self
Create a receiver with a custom reorder buffer size.
Sourcepub fn add(
&mut self,
seq: u64,
path_id: &str,
data: Vec<u8>,
) -> Option<(String, Vec<u8>)>
pub fn add( &mut self, seq: u64, path_id: &str, data: Vec<u8>, ) -> Option<(String, Vec<u8>)>
Add a received packet.
Returns Some((path_id, data)) if this completes an in-order sequence,
or None if the packet is buffered waiting for earlier packets.
Duplicate packets (same seq already seen) are silently dropped.
Sourcepub fn drain_ordered(&mut self) -> Vec<(u64, String, Vec<u8>)>
pub fn drain_ordered(&mut self) -> Vec<(u64, String, Vec<u8>)>
Try to drain buffered packets that are now in order.
Call after add() returns Some(...) to flush any buffered packets.
Returns packets in sequence order.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of packets currently buffered.
Sourcepub fn total_received(&self) -> u64
pub fn total_received(&self) -> u64
Total packets received (including duplicates and out-of-order).
Sourcepub fn total_delivered(&self) -> u64
pub fn total_delivered(&self) -> u64
Total packets delivered in order.
Sourcepub fn total_duplicates(&self) -> u64
pub fn total_duplicates(&self) -> u64
Total duplicate packets dropped.