Skip to main content

defer_admission_retire

Function defer_admission_retire 

Source
fn defer_admission_retire(
    admission: Option<Arc<dyn SurbAdmissionControl>>,
    grace: Duration,
    session_id: &SessionId,
    token: AdmissionToken,
)
Expand description

Retires pseudonym on behalf of token, after a grace derived from the pipeline’s SURB-resolution window (see surb_retire_grace), when a runtime is running.

Spawned through Handle::try_current rather than tokio::spawn because the teardowns that reach this helper are synchronous (close_session, the sessions cache’s eviction listener, SessionSlotGuard::drop) and can run off-runtime, where tokio::spawn panics. The off-runtime fallback retires inline, which is correct rather than merely convenient: a teardown with no runtime under it has no packet pipeline resolving return routes on its behalf either, so the SURB-resolution window the deferral exists to cover cannot be in progress — there is nothing to wait out.