fn exit_data_egress<Si>(
sink: Si,
session_id: SessionId,
estimator: AtomicSurbFlowEstimator,
balancer: Arc<BalancerStateValues>,
gate: Option<Arc<ServiceGate>>,
keeps_alive: bool,
) -> impl Sink<(DestinationRouting, ApplicationDataOut), Error = Error>Expand description
The Exit’s data egress for a rate-controlled Session: holds each packet back while the SURB stock
is down to the keep-alive reserve of the target balancer holds (once the Entry refills it, see
hold_for_surb_reserve), books the SURB it consumes, and passes it through the PIX egress gate.
Built as one piece, and not inline where the Session is set up, so that the order of its three steps can be tested: the SURB is booked only when the packet goes on, so a packet that is held is not counted against the very stock it is waiting for.
The SURB is booked with the refund that gives it back (see count_return_packet_surb), as on
every other path a return packet takes: a packet the gate refuses, or one routing resolution drops
for want of a SURB, does not keep the stock the reserve is measured against one low.
keeps_alive says whether the Exit runs a keep-alive stream for the Session (a SURB-level
notification period, or PIX fill; see SessionManager::spawn_exit_keep_alive). The reserve is
kept for that stream, so without one nothing is held back.