iroh
iroh copied to clipboard
(iroh-net) Manage tasks for `Discovery::publish` in `MagicEndpoint`
Discovery::publish is currently a one-off sync function calls and async publish impls are expected to start their own task with tokio::task::spawn. This means those tasks cannot be aborted when the magic endpoint shuts down.
Instead we should either pass a cancellation token or a JoinSet to spawn tasks into.
See also this discussion: https://github.com/n0-computer/iroh/pull/2056#discussion_r1511535760