Skip to main content

book_start_message_surbs

Function book_start_message_surbs 

Source
fn book_start_message_surbs(
    slot: &SessionSlot,
    session_id: &SessionId,
    stored: SurbsStored,
) -> bool
Expand description

Books what a Start-protocol packet did to an incoming Session’s SURB store: the SURBs it carried and the ones the store lost to it. A no-op for an outgoing Session, whose counterparty stores no SURBs of ours.

Every Start message from the Entry delivers SURBs into the Session’s ring exactly as a data packet does, whatever the message is: a keep-alive, an SsaCommit, the opening StartSession. Booking only the keep-alives left the others’ SURBs out of the Exit’s level while the evictions they caused later were booked, so once a ring sized off the announced target ran full, the estimate sank below the target for good and the Exit’s egress controller, which follows it, sent nothing at all.

What the packet carried is booked, not a message’s max_surbs(): that is how many fit beside it, what the sender was allowed to send rather than what the store took. And the evictions, which are how a SURB generation wipe, and any overflow, reaches the Exit’s level.

Returns whether it booked anything, i.e. whether slot is an incoming Session.