refactor(peer): extract peer startup task spawning

The peer runtime used to spawn each long-running service inline inside
run_peer. That made the startup path harder to scan because service names,
clone setup, and task error handling were interleaved with the command loop.

Move the task wrappers into a startup module and leave run_peer as the
lifecycle overview: create shared context, start services, handle commands,
then send shutdown goodbyes. The spawned services and their error handling are
unchanged; only the ownership plumbing moved into named helpers.

Test Plan:
- cargo clippy
- cargo clippy --benches
- cargo clippy --tests
- cargo +nightly fmt

Refs: none
This commit is contained in:
2026-05-02 16:02:37 +02:00
parent 3fb516af2b
commit 8f35a197a9
3 changed files with 135 additions and 76 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
//! Long-running peer services.
//!
//! Each submodule owns one runtime concern. The public surface intentionally
//! stays small because `lib.rs` only needs to start these four background tasks.
//! stays small because peer startup only needs to start these four background
//! tasks.
mod advertise;
mod discovery;