Skip to main content

resume_publication

Function resume_publication 

Source
async fn resume_publication<S>(
    session_id: SessionId,
    pseudonym: HoprPseudonym,
    routing: &DestinationRouting,
    ssa_state: &SessionSsaState,
    pix_toolbox: &PixToolbox,
    msg_sender: &mut S,
) -> Result<()>
where S: Sink<(DestinationRouting, ApplicationDataOut)> + Unpin, S::Error: Error + Send + Sync + Clone + 'static,
Expand description

Finishes publishing the batch an interrupted publication left behind, member by member in ascending order, stopping at the first transport failure.

Each member still owed is claimed first — removed from SessionSsaState’s unpublished set, which is what makes it this call’s alone — and then published in full: its whole burst, rebuilt from the material the generator retains for the cycle, and only then the ReadyToDeposit that was owed. Every member that is published here is published whole, and by exactly one caller, so a resumption can neither announce a deposit twice nor race the original publication or another resumption into doing so. A member whose publication fails goes back, the failure is reported through publication_cut_short, and the members after it were never claimed, so all of them stay owed for the next attempt.

The whole burst is re-sent rather than only what went missing, because what went missing is not known: the Entry’s send failed at some message and says nothing about the ones the transport accepted before it, and the Exit’s request names parts of a commitment it may not even have started to receive. That costs one of the cycle’s MAX_COMMITMENT_RETRANSMISSIONS answers, and that cap is what bounds how often a cycle can be re-published. Once it is spent the generator refuses (PixError::InvalidInput), and so it does when nothing is retained for the cycle any more (PixError::MissingSsaCommitment): either way the cycle can never be published again, so it is dropped from the owed set with a single warning rather than kept to cost a blocking recommit and a log line on every re-send. It is never announced, and nothing is stranded by that. Dropping one member does not stop the others, and the call is successful if the rest were published.

A resumption is reached only through a repeat of the request or a scoped re-request that names an owed cycle, so it covers what the Exit asks about. See SessionSsaState::unpublished for what nothing prompts.