From d97a2a81c39a8dafd7d8b02dadf5e9f8244ec4e0 Mon Sep 17 00:00:00 2001 From: Aubrey Taylor Date: Sat, 4 Jan 2025 02:33:12 -0600 Subject: [PATCH] hole punch harder fuck you --- src/player.rs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/player.rs b/src/player.rs index 2a45365..9efda79 100644 --- a/src/player.rs +++ b/src/player.rs @@ -146,10 +146,10 @@ impl PlayerActor { trace!("now connected on udp at {}", SocketAddr::new(ip, port)); addr = Some(SocketAddr::new(ip, port)); - let mut buf = [0; 256]; - let mut writer = Cursor::new(buf.as_mut_slice()); - write_packet(&mut writer, user_id, PacketData::HolePunch(HolePunch)).await.unwrap(); - socket.send_to(&buf, addr.as_ref().unwrap()).await.expect("kys"); + // let mut buf = [0; 256]; + // let mut writer = Cursor::new(buf.as_mut_slice()); + // write_packet(&mut writer, user_id, PacketData::HolePunch(HolePunch)).await.unwrap(); + // socket.send_to(&buf, addr.as_ref().unwrap()).await.expect("kys"); } } } @@ -260,6 +260,30 @@ 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: 0, + udp: false, + data: PacketData::HolePunch(HolePunch), + })) + .map_err(drop); + let _ = self + .write_sender + .send(WriteMessage::Data(Packet { + user_id: 0, + udp: false, + data: PacketData::HolePunch(HolePunch), + })) + .map_err(drop); + let _ = self + .write_sender + .send(WriteMessage::Data(Packet { + user_id: 0, + udp: false, + data: PacketData::HolePunch(HolePunch), + })) + .map_err(drop); return; } PacketData::Connect(..) | PacketData::Init(..) => {