From 58795eb87e1ad0a29d541bb0bd5a0524dd764ddd Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Sat, 5 Jul 2025 19:28:14 -0400 Subject: [PATCH 1/4] Don't expose heartbeat to app --- src/game/net.rs | 1 - src/net/io.rs | 6 ++++-- src/net/peer.rs | 2 +- src/net/plugin.rs | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/game/net.rs b/src/game/net.rs index 2cde3b5..524b376 100644 --- a/src/game/net.rs +++ b/src/game/net.rs @@ -11,7 +11,6 @@ pub fn handle_new_peer( ) { if let Some(seed) = seed { for peer in new_peers { - warn!("Sending seed to peer: {}", peer.uuid); outbound.write(OutboundPacket(Packet::new((*seed).into(), peer.uuid))); } } diff --git a/src/net/io.rs b/src/net/io.rs index d02a3da..7dcceca 100644 --- a/src/net/io.rs +++ b/src/net/io.rs @@ -26,7 +26,9 @@ pub fn handle_network_input( .into()); } let uuid = Uuid::from_slice(message.split_off(message.len() - 16).as_slice())?; - to_app.write(InboundPacket(Packet::new(message, uuid))); + if !message.is_empty() { + to_app.write(InboundPacket(Packet::new(message, uuid))); + } if let Some(peer_id) = peer_map.get(&uuid) { let (peer, mut last) = peers.get_mut(*peer_id)?; last.update(&time); @@ -74,7 +76,7 @@ pub fn heartbeat( } } -pub fn timeouts( +pub fn timeout( peers: Query<(&Peer, &PeerReceiveTiming)>, time: Res