[PR #421] feat: peer version exchange via Hello proto event #413

Open
opened 2026-05-05 22:18:33 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/feschber/lan-mouse/pull/421
Author: @jondkinney
Created: 5/6/2026
Status: 🔄 Open

Base: mainHead: split/02-peer-version


📝 Commits (4)

  • d8414c9 fix(proto): tolerate undecodable peer datagrams instead of disconnecting
  • cd044be feat: peer version exchange with soft-warn UI indicator
  • 64212e0 ui(client_row): sentence-case "Peer version" and "Ours" labels
  • 0598b89 fix(version-exchange): also store peer commit on the listen side

📊 Changes

14 files changed (+208 additions, -13 deletions)

View changed files

📝 lan-mouse-gtk/src/client_object.rs (+10 -0)
📝 lan-mouse-gtk/src/client_object/imp.rs (+1 -0)
📝 lan-mouse-gtk/src/client_row.rs (+36 -0)
📝 lan-mouse-gtk/src/lib.rs (+24 -2)
📝 lan-mouse-gtk/src/window.rs (+7 -0)
📝 lan-mouse-ipc/src/lib.rs (+6 -0)
📝 lan-mouse-proto/src/lib.rs (+27 -0)
📝 src/client.rs (+6 -0)
📝 src/config.rs (+12 -0)
📝 src/connect.rs (+30 -8)
📝 src/emulation.rs (+27 -0)
📝 src/listen.rs (+10 -2)
📝 src/main.rs (+1 -1)
📝 src/service.rs (+11 -0)

📄 Description

Summary

Peer version exchange — each peer surfaces the other's build commit hash in the GUI, with a soft-warn color indicator on mismatch.

ProtoEvent::Hello { commit: [u8; 8] } carries each peer's shadow_rs SHORT_COMMIT once per session. Sender fires immediately after DTLS auth; listener mirrors the event back so the connect side's receive_loop populates ClientState::peer_commit for the right handle. Disconnect path clears it.

Each outgoing-connection row's collapsed subtitle renders match status with Pango-colored markup: green when commits match, orange when mismatched or when the peer hasn't sent Hello (older build). Soft-warn only — version mismatch never refuses traffic. The local commit reaches the GTK frontend (separate process) via an explicit local_commit parameter on lan_mouse_gtk::run, stashed in a OnceLock so per-row UI can compare against each peer's hash without an IPC round-trip.

EventType::Hello is appended to the enum so existing IDs are untouched. Old peers hit the existing InvalidEventId skip path from 3025422 and silently ignore the event — backward interop preserved.

Listen-side mirror (1ea7148): the original implementation read peer_commit only off the outgoing-connect path, on the assumption that bidirectional setups always have a working outbound connection in both directions. That assumption broke the moment any direction's outbound was down (e.g. peer's TCP listener temporarily not bound) — version display silently said "unknown" while the peer was happily sending events to us inbound. New EmulationEvent::PeerHello { addr, commit } variant fired from the listen-side Hello handler; service maps addr → ClientHandle via client_manager.get_client(addr) and stamps peer_commit exactly like the connect path. Version visibility is now independent of outbound reachability.

Test plan

  • Same-commit pairs render the row's subtitle with a green "matched" indicator
  • Cross-build pairs (one side pre-Hello) render orange "unknown" — verified bidirectionally
  • One-direction-down setups (peer's outbound to us is broken) still show the peer's version because of the listen-side mirror
  • Disconnecting a peer clears peer_commit so the next connect starts fresh

Split out from #418, the umbrella PR collecting ~10 independent feature areas. This PR is the peer-version-exchange subset and stacks on top of the cursor-sync/wall-press PR. See #418 for the full picture.

Stack overview

These PRs are split out from #418 and stack in this order:

  1. #420 — cursor sync + wall-press + host-lock + slider/UI
  2. #421 — peer version exchange
  3. #422 — hostname resolver + multi-homed DTLS listener
  4. #423 — mDNS-SD service-order discovery
  5. #424 — macOS QoL + UI polish
  6. #425 — scroll forwarding
  7. #426 — GUI singleton

Each PR's branch builds on the previous one, so until earlier PRs are merged the cumulative diff against main includes all preceding work. Reviewing in order is easiest.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/feschber/lan-mouse/pull/421 **Author:** [@jondkinney](https://github.com/jondkinney) **Created:** 5/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `split/02-peer-version` --- ### 📝 Commits (4) - [`d8414c9`](https://github.com/feschber/lan-mouse/commit/d8414c9505222dc279b26348df77a489af1b4e78) fix(proto): tolerate undecodable peer datagrams instead of disconnecting - [`cd044be`](https://github.com/feschber/lan-mouse/commit/cd044beb6c9f6e884a6f702b1bddeb22ddf96de0) feat: peer version exchange with soft-warn UI indicator - [`64212e0`](https://github.com/feschber/lan-mouse/commit/64212e0a41baba839211029885786c1dc26af11a) ui(client_row): sentence-case "Peer version" and "Ours" labels - [`0598b89`](https://github.com/feschber/lan-mouse/commit/0598b897067f486c6cc9c5b5f56b3575cc02e3e2) fix(version-exchange): also store peer commit on the listen side ### 📊 Changes **14 files changed** (+208 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `lan-mouse-gtk/src/client_object.rs` (+10 -0) 📝 `lan-mouse-gtk/src/client_object/imp.rs` (+1 -0) 📝 `lan-mouse-gtk/src/client_row.rs` (+36 -0) 📝 `lan-mouse-gtk/src/lib.rs` (+24 -2) 📝 `lan-mouse-gtk/src/window.rs` (+7 -0) 📝 `lan-mouse-ipc/src/lib.rs` (+6 -0) 📝 `lan-mouse-proto/src/lib.rs` (+27 -0) 📝 `src/client.rs` (+6 -0) 📝 `src/config.rs` (+12 -0) 📝 `src/connect.rs` (+30 -8) 📝 `src/emulation.rs` (+27 -0) 📝 `src/listen.rs` (+10 -2) 📝 `src/main.rs` (+1 -1) 📝 `src/service.rs` (+11 -0) </details> ### 📄 Description ## Summary Peer version exchange — each peer surfaces the other's build commit hash in the GUI, with a soft-warn color indicator on mismatch. `ProtoEvent::Hello { commit: [u8; 8] }` carries each peer's `shadow_rs` `SHORT_COMMIT` once per session. Sender fires immediately after DTLS auth; listener mirrors the event back so the connect side's `receive_loop` populates `ClientState::peer_commit` for the right handle. Disconnect path clears it. Each outgoing-connection row's collapsed subtitle renders match status with Pango-colored markup: green when commits match, orange when mismatched or when the peer hasn't sent `Hello` (older build). Soft-warn only — version mismatch never refuses traffic. The local commit reaches the GTK frontend (separate process) via an explicit `local_commit` parameter on `lan_mouse_gtk::run`, stashed in a `OnceLock` so per-row UI can compare against each peer's hash without an IPC round-trip. `EventType::Hello` is appended to the enum so existing IDs are untouched. Old peers hit the existing `InvalidEventId` skip path from `3025422` and silently ignore the event — backward interop preserved. **Listen-side mirror (`1ea7148`):** the original implementation read `peer_commit` only off the outgoing-connect path, on the assumption that bidirectional setups always have a working outbound connection in both directions. That assumption broke the moment any direction's outbound was down (e.g. peer's TCP listener temporarily not bound) — version display silently said "unknown" while the peer was happily sending events to us inbound. New `EmulationEvent::PeerHello { addr, commit }` variant fired from the listen-side Hello handler; service maps `addr → ClientHandle` via `client_manager.get_client(addr)` and stamps `peer_commit` exactly like the connect path. Version visibility is now independent of outbound reachability. ## Test plan - [x] Same-commit pairs render the row's subtitle with a green "matched" indicator - [x] Cross-build pairs (one side pre-Hello) render orange "unknown" — verified bidirectionally - [x] One-direction-down setups (peer's outbound to us is broken) still show the peer's version because of the listen-side mirror - [x] Disconnecting a peer clears `peer_commit` so the next connect starts fresh --- Split out from #418, the umbrella PR collecting ~10 independent feature areas. This PR is the peer-version-exchange subset and stacks on top of the cursor-sync/wall-press PR. See #418 for the full picture. ## Stack overview These PRs are split out from #418 and stack in this order: 1. #420 — cursor sync + wall-press + host-lock + slider/UI 2. #421 — peer version exchange 3. #422 — hostname resolver + multi-homed DTLS listener 4. #423 — mDNS-SD service-order discovery 5. #424 — macOS QoL + UI polish 6. #425 — scroll forwarding 7. #426 — GUI singleton Each PR's branch builds on the previous one, so until earlier PRs are merged the cumulative diff against `main` includes all preceding work. Reviewing in order is easiest. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 22:18:33 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/lan-mouse#413
No description provided.