Files
buzz/crates
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d e8e258170b fix(relay): structurally gate NIP-43 fleet sweep on listener bind
Review found the sweep-after-bind ordering was probabilistic: the sweep
task is spawned before serve(), zero jitter is a valid draw, and
interval.tick() fires immediately — so the fleet sweep could still start
pre-bind. Replace the timing assumption with a structural guarantee:

- new after_listener_bound(oneshot::Receiver, task) helper; the gated
  task runs only after the signal fires and never runs if the sender is
  dropped (startup failed before bind)
- serve() takes a listener_bound_tx: oneshot::Sender<()> and fires it
  immediately after the main TCP listener binds
- the fleet sweep task is wrapped in after_listener_bound; jitter is now
  explicitly only lock-contention spreading, not ordering

Adds two deterministic tests: a yield-storm test proving the task cannot
run before the signal even with zero delay, and a dropped-sender test
proving the task never runs when startup fails pre-bind.

Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
2026-08-03 13:02:13 -04:00
..
2026-07-27 14:18:24 -04:00