pub struct ReassemblyBuffer { /* private fields */ }Expand description
Per-peer reassembly buffer for NDNLPv2 fragments.
Tracks incomplete reassemblies keyed by sequence number. When all fragments
of a packet arrive, process() returns the reassembled packet.
Implementations§
Source§impl ReassemblyBuffer
impl ReassemblyBuffer
pub fn new(timeout: Duration) -> Self
Sourcepub fn process(
&mut self,
seq: u64,
frag_index: u64,
frag_count: u64,
fragment: Bytes,
) -> Option<Bytes>
pub fn process( &mut self, seq: u64, frag_index: u64, frag_count: u64, fragment: Bytes, ) -> Option<Bytes>
Feed a decoded LpPacket fragment.
Returns Some(complete_packet) when all fragments of the original
packet have been received. Returns None if fragments are still
missing or if the packet has no fragmentation fields.
Sourcepub fn purge_expired(&mut self)
pub fn purge_expired(&mut self)
Drop incomplete reassemblies older than the configured timeout.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of in-progress reassemblies.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReassemblyBuffer
impl RefUnwindSafe for ReassemblyBuffer
impl Send for ReassemblyBuffer
impl Sync for ReassemblyBuffer
impl Unpin for ReassemblyBuffer
impl UnwindSafe for ReassemblyBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more