diff --git a/src/network/gossip.rs b/src/network/gossip.rs index c2428d8..c017a8a 100644 --- a/src/network/gossip.rs +++ b/src/network/gossip.rs @@ -133,12 +133,13 @@ fn admit_state_mutation( fn peer_state_for_log(state: &PeerState) -> String { format!( - "name={:?}, muted={}, addr_id={}, addrs={}, sharing={}", + "name={:?}, muted={}, addr_id={}, addrs={}, sharing={}, game={:?}", state.name, state.is_muted, crate::short_id(&state.addr.id.to_string()), state.addr.addrs.len(), - state.sharing.is_some() + state.sharing.is_some(), + state.game ) } @@ -717,6 +718,16 @@ mod tests { EndpointAddr::from(id) } + #[test] + fn peer_state_log_includes_game() { + let mut state = sample_peer_state_for(fresh_id()); + state.game = Some("Half-Life 2".to_string()); + assert!(peer_state_for_log(&state).contains("game=Some(\"Half-Life 2\")")); + + state.game = None; + assert!(peer_state_for_log(&state).contains("game=None")); + } + #[test] fn bootstrap_client_dials_host() { // A non-host (client) with no retained peers dials just the ticket host.