Commit Graph

55 Commits

Author SHA1 Message Date
ddidderr 87d00e7df6 refactor(peer): make startup directory-driven
Peer startup used to bootstrap itself by spawning the runtime and immediately
sending a SetGameDir command back through its own control channel. The Tauri
integration then polled shared state until a directory appeared and waited two
seconds before asking peers for games. That made startup ordering implicit and
left a race-prone sleep in the UI bridge.

Install the initial game directory directly into the peer context instead. The
runtime now attempts the initial local-library scan before starting discovery,
then launches the server, discovery, liveness, and local monitor services from
that initialized context. Later directory changes still use SetGameDir, so the
existing UI command surface stays intact.

Use PathBuf and Path references across peer filesystem boundaries so directory
state is represented as a path rather than an optional string. The Tauri layer
now validates a selected game directory before storing it, loads the bundled
catalog on first use, and starts or updates the peer runtime from one helper.
Peer event fan-out is split into named handlers so the Tauri setup closure only
wires state and starts the event loop.

Shutdown goodbye notifications are still best-effort, but they are now awaited
with a short timeout instead of being spawned and forgotten. The tradeoff is a
small bounded wait during peer runtime shutdown in exchange for clearer task
ownership.

Test Plan:
- cargo test -p lanspread-peer
- cargo clippy
- cargo clippy --benches
- cargo clippy --tests
- cargo +nightly fmt
- git diff --check

Refs: none
2026-05-02 17:09:00 +02:00
ddidderr 8f35a197a9 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
2026-05-02 16:02:37 +02:00
ddidderr b4585b663a ChatGPT Codex 5.5 xhigh refactored even more 2026-05-02 15:31:37 +02:00
ddidderr 86d0f93ede asd 2026-02-26 20:12:25 +01:00
ddidderr b60dcef471 ChatGPT Codex 5.2 xhigh refactored > 45min 2026-01-13 18:59:12 +01:00
ddidderr f76d59265c Plan to cleanup everything by Codex 5.2 (xhigh) 2026-01-03 22:21:29 +01:00
ddidderr 53c7fe10ba refactor (Opus 4.5): modularize and split 2025-11-28 21:10:42 +01:00
ddidderr df01131f8d refactor: Centralize local game database updates and announcements, and add retry logic for requesting games from peers. 2025-11-18 21:42:47 +01:00
ddidderr f9923bd61e feat: Implement length-delimited framing for QUIC stream communication using tokio-util and futures. 2025-11-18 20:39:38 +01:00
ddidderr 84eeebb633 feat: Exclude .sync, .softlan_first_start_done, and local directories from root size calculation. 2025-11-18 19:47:41 +01:00
ddidderr e2f0dfa792 feat: Enable peers to announce and synchronize local game libraries. 2025-11-18 19:08:29 +01:00
ddidderr 293ede96ed ugly 2025-11-14 11:28:55 +01:00
ddidderr f88fa5794c skip descending into local 2025-11-14 11:08:37 +01:00
ddidderr 86cf3e87f7 skip .sync and .softlan_game_installed 2025-11-14 10:34:45 +01:00
ddidderr e435be4d94 unsafe for the win 2025-11-14 09:39:59 +01:00
ddidderr 833c8afedf game thumbnails 2025-11-14 09:03:05 +01:00
ddidderr 567d293455 game sizes? 2025-11-14 08:12:09 +01:00
ddidderr 2952b596e2 peers gone... 2025-11-14 02:16:53 +01:00
ddidderr fe7444be4f wip 2025-11-14 01:59:07 +01:00
ddidderr da8457edfc wip 2025-11-14 01:44:39 +01:00
ddidderr f209653842 dead peer discovery and available games updates 2025-11-14 01:24:42 +01:00
ddidderr 8432030292 detect if a game is deleted, added, modified locally 2025-11-14 01:12:01 +01:00
ddidderr 4764bb9fd3 log chunks 2025-11-14 01:02:49 +01:00
ddidderr 1b2b2cf8c0 file transfer: improve / fix 2025-11-14 00:47:02 +01:00
ddidderr 4e9707dd51 mdns improved peer discovery 2025-11-14 00:24:04 +01:00
ddidderr b9e3e760d9 peer count in UI 2025-11-14 00:03:32 +01:00
ddidderr 32e909448f wip 2025-11-13 23:58:04 +01:00
ddidderr a1dfc5cc89 wip 2025-11-13 23:42:12 +01:00
ddidderr c1d20189c3 game files list: filter out local 2025-11-13 21:59:05 +01:00
ddidderr 8fe68f9574 wip 2025-11-13 21:43:20 +01:00
ddidderr 157c8ab68d log noise, chunk size 32MB 2025-11-13 21:23:50 +01:00
ddidderr 97bd87640e mdns 2025-11-13 20:50:43 +01:00
ddidderr 4b8a361b9a wip 2025-11-13 20:42:05 +01:00
ddidderr 651e3db988 mdns fix: use heuristic to find suitable interface and use IP of that interface to anounce service 2025-11-13 20:35:29 +01:00
ddidderr 2baf32f78a info 2025-11-13 20:01:48 +01:00
ddidderr 2d7f7513ad peer count for all games 2025-11-13 19:38:21 +01:00
ddidderr 16aeade138 ui 2025-11-13 09:22:05 +01:00
ddidderr cc2c4ea8f3 wip 2025-11-12 23:30:08 +01:00
ddidderr 5e340df9d8 wip 2025-11-12 23:19:23 +01:00
ddidderr 0f4e40383b load game.db 2025-11-12 22:56:59 +01:00
ddidderr d994e741b1 early error on peer's failure to determine file size 2025-11-12 22:29:00 +01:00
ddidderr f2808192f7 wip 2025-11-12 22:22:33 +01:00
ddidderr bca85fbdc1 always a size 2025-11-12 22:11:29 +01:00
ddidderr 8b9e09ab81 pre alloc 2025-11-12 22:07:23 +01:00
ddidderr bdfb461efc codec review 2025-11-12 21:36:13 +01:00
ddidderr d9f8a342e6 path validation 2025-11-12 20:42:15 +01:00
ddidderr f046fac303 codex review and fixes 2025-11-11 22:02:07 +01:00
ddidderr 4f3c720e33 README lanspread-peer 2025-11-11 21:45:44 +01:00
ddidderr bcda99d3a8 unused peerconnection removed 2025-11-11 21:44:18 +01:00
ddidderr 2cf060bcc2 wip 2025-11-11 21:36:12 +01:00