Skip to main content

take_hand_offs

Function take_hand_offs 

Source
pub async fn take_hand_offs(
    client: &PeerClient,
    trust: &PinnedTrust,
    versions: &dyn DirectoryVersions,
    delegate_device: Uuid,
    max_protocol: &str,
    inbox: &dyn DelegateInbox,
    partials: &mut BTreeMap<String, Vec<u8>>,
) -> TakenHandOffs
Expand description

The delegate’s side of a hand-off over a verified peering channel: pull each hand-off the peer offers, verify it (accept_hand_off_from, so it must be the verified peer’s own), persist it durably, and only then acknowledge it over the same channel.

partials holds the bytes of pulls an earlier session lost with its channel, by address: a pull resumes after them and re-fetches none of them, and a pull severed now leaves what it received there. A hand-off the inbox already holds (taken in an earlier session whose acknowledgement was lost) is re-verified from the inbox and acknowledged again, not pulled.

The session ends with PeerClient::finish unless the channel broke or the peer refused a request, which ends it on the peer’s side.