From 4f75b3c1562dde2e05586c321be67c0b44633051 Mon Sep 17 00:00:00 2001 From: Aubrey Taylor Date: Fri, 3 Jan 2025 23:01:34 -0600 Subject: [PATCH] remove and add logging --- src/main.rs | 2 +- src/player.rs | 9 ++------- src/server/prox.rs | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3dcf061..c81dd9c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -116,7 +116,7 @@ async fn udp_server(socket: Arc) { loop { let mut packet = [0u8; 256]; let (size, _addr) = socket.recv_from(&mut packet).await.unwrap(); - tracing::trace!("got packet from {_addr:?}"); + // tracing::trace!("got packet from {_addr:?}"); match read_packet(&mut Cursor::new(&mut packet[..size]), true).await { Ok(packet) => { // info!("packet from udp {packet:?}"); diff --git a/src/player.rs b/src/player.rs index d4979d1..f2ca721 100644 --- a/src/player.rs +++ b/src/player.rs @@ -109,7 +109,7 @@ impl PlayerActor { tokio::spawn(scoped(&address.downgrade(), { let address = address.downgrade(); async move { - // sending packets to the web app or setting up udp + // sending packets to the game or setting up udp let ip = addr.ip(); let mut addr = None; while let Some(message) = receiver.recv().await { @@ -142,7 +142,7 @@ impl PlayerActor { } } WriteMessage::SetUdp(port) => { - trace!("now connected on udp!"); + trace!("now connected on udp at {}", SocketAddr::new(ip, port)); addr = Some(SocketAddr::new(ip, port)); let mut buf = [0; 256]; @@ -258,11 +258,6 @@ impl Handler for PlayerActor { PacketData::UdpInit(UdpInit { port }) => { info!("got udp init {port}!"); let _ = self.write_sender.send(WriteMessage::SetUdp(port)); - let _ = self.write_sender.send(WriteMessage::Data(Packet { - user_id: self.id, - udp: true, - data: PacketData::HolePunch(HolePunch), - })); return; } PacketData::Connect(..) | PacketData::Init(..) => { diff --git a/src/server/prox.rs b/src/server/prox.rs index f7d1093..9305d0f 100644 --- a/src/server/prox.rs +++ b/src/server/prox.rs @@ -46,6 +46,7 @@ impl ProximityPlayer { let state = manager.send(RequestState).await.unwrap(); send.write_u8(state.len() as u8).await.expect("failed to write length"); + trace!("sending player count: {}", state.len()); for player in state.values() { trace!(parent: &span, "sending player {player:?}"); send.write_all(player.as_bytes()).await.expect("failed to write player");