From 241dee2649b601ebb43326345cd0ea85b845f55a Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 14 Oct 2026 23:45:53 +0200 Subject: [PATCH] Invite friends: count direct and relayed sessions in friends status Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/game/friends.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/horizon-client/src/game/friends.rs b/crates/horizon-client/src/game/friends.rs index 0ccdcfdff..57a2c09de 100644 --- a/crates/horizon-client/src/game/friends.rs +++ b/crates/horizon-client/src/game/friends.rs @@ -16,6 +16,8 @@ pub(super) struct Sharing { code: Option, /// Wrong codes tried against the current code. wrong: u32, + /// Sessions carried directly and through the relay so far. + paths: (u32, u32), notice: Option, copied: Option, } @@ -67,6 +69,7 @@ impl Game<'_> { opened_lan, code: None, wrong: 0, + paths: (0, 0), notice: None, copied: None, }); @@ -120,7 +123,9 @@ impl Game<'_> { sharing.wrong = count; sharing.notice = Some(format!("Someone tried a wrong code ({count} of 5).")); } - HostEvent::Connected { .. } | HostEvent::Disconnected { .. } => {} + HostEvent::Connected { direct: true, .. } => sharing.paths.0 += 1, + HostEvent::Connected { direct: false, .. } => sharing.paths.1 += 1, + HostEvent::Disconnected { .. } => {} } } if let HostState::Retrying(_) = sharing.host.state() { @@ -205,6 +210,8 @@ impl Game<'_> { "code": view.code, "state": state, "sessions": self.friends.as_ref().map_or(0, |s| s.host.sessions()), + "direct": self.friends.as_ref().map_or(0, |s| s.paths.0), + "relayed": self.friends.as_ref().map_or(0, |s| s.paths.1), "guests": view.guests, "lan_port": self.lan_port(), })))