Skip to main content

receive

Function receive 

Source
pub fn receive<L: DataLinkLayer>(link: &mut L, first: &[u8]) -> Result<Vec<u8>>
Expand description

Reassembles a general-block-transfer sequence starting from first, the already-received first frame (typically the result of the caller’s own link.receive_apdu() used to detect the GENERAL_BLOCK_TRANSFER tag), reading further blocks from link as needed. Handles out-of-order and duplicate blocks by requesting retransmission / acking-and-discarding.

In confirmed mode (peer window > 0), acks are sent at the same cadence the sender waits on — every window accepted blocks — so the two sides stay in lockstep; acking every block regardless of window size would desynchronize a sender that only checks for an ack once per window and trigger spurious retransmits.

Returns the reassembled plain (or still-ciphered, if the segmented APDU was ciphered) APDU bytes.