fn cap_organic_surbs(
data: &mut ApplicationDataOut,
max_out: bool,
surb_mgmt: &BalancerStateValues,
)Expand description
Caps how many SURBs an outgoing Session data packet may carry, per the SURB balancer.
max_out is the client’s always_max_out_surbs opt-in, which wins outright: a client that has
asked for the maximum has said something about its own traffic that the balancer’s estimate
cannot contradict.
Otherwise the cap comes from BalancerStateValues::organic_surbs_per_packet, which yields 0
once the counterparty is estimated to be at its target. That zero is the whole point of the
function: without it, the balancer can silence its keep-alives and still have organic SURBs
pouring into a full buffer, where each one evicts an older SURB.
Nothing else has to change to keep the SURB accounting straight: this runs in front of the
counting sink, so estimate_surbs_with_msg reports the capped figure.