From bd581ae317c4cebff7b0ff016ba473236b9ae062 Mon Sep 17 00:00:00 2001 From: Aubrey Taylor Date: Thu, 2 Jan 2025 19:15:43 -0600 Subject: [PATCH] bring back logging --- src/main.rs | 2 +- src/player.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 19c17f1..3dcf061 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(); - // 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 cd23456..d4979d1 100644 --- a/src/player.rs +++ b/src/player.rs @@ -246,9 +246,9 @@ impl Handler for PlayerActor { type Return = (); async fn handle(&mut self, packet: Packet, _: &mut xtra::Context) { - if matches!(packet.data, PacketData::HolePunch(..)) { - return; - } + // if matches!(packet.data, PacketData::HolePunch(..)) { + // return; + // } if packet.user_id == self.id { match packet.data { @@ -256,9 +256,10 @@ impl Handler for PlayerActor { info!("got hole punch!"); } 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: 0, + user_id: self.id, udp: true, data: PacketData::HolePunch(HolePunch), }));