Problem
A full TUI needs deterministic shutdown. Some background tasks and actor children are killed directly or spawned without a public cancellation/shutdown surface.
Relevant code:
- Torrent actor stop kills peers/trackers/store/scheduler:
crates/libtortillas/src/torrent/actor.rs:572
- UDP server starts an unmanaged receiver task:
crates/libtortillas/src/tracker/udp.rs:403
- Swarm peer connections use
tokio::spawn: crates/libtortillas/src/torrent/swarm.rs:30
Dependencies
Blocked by #225 for public lifecycle semantics.
Blocked by #232 because engine startup/shutdown should both be explicit frontend-visible phases.
Acceptance criteria
- Engine shutdown stops torrents, trackers, peers, schedulers, UDP receiver tasks, and outstanding connection tasks.
- Shutdown is awaitable and returns typed errors for failures/timeouts.
- Repeated shutdown calls are safe.
- No task leaks are expected after shutdown.
- Tests cover graceful shutdown of an engine with at least one torrent actor.
Problem
A full TUI needs deterministic shutdown. Some background tasks and actor children are killed directly or spawned without a public cancellation/shutdown surface.
Relevant code:
crates/libtortillas/src/torrent/actor.rs:572crates/libtortillas/src/tracker/udp.rs:403tokio::spawn:crates/libtortillas/src/torrent/swarm.rs:30Dependencies
Blocked by #225 for public lifecycle semantics.
Blocked by #232 because engine startup/shutdown should both be explicit frontend-visible phases.
Acceptance criteria