hole punch harder fuck you
This commit is contained in:
parent
40e8f0f7a9
commit
d97a2a81c3
|
@ -146,10 +146,10 @@ impl PlayerActor {
|
||||||
trace!("now connected on udp at {}", SocketAddr::new(ip, port));
|
trace!("now connected on udp at {}", SocketAddr::new(ip, port));
|
||||||
addr = Some(SocketAddr::new(ip, port));
|
addr = Some(SocketAddr::new(ip, port));
|
||||||
|
|
||||||
let mut buf = [0; 256];
|
// let mut buf = [0; 256];
|
||||||
let mut writer = Cursor::new(buf.as_mut_slice());
|
// let mut writer = Cursor::new(buf.as_mut_slice());
|
||||||
write_packet(&mut writer, user_id, PacketData::HolePunch(HolePunch)).await.unwrap();
|
// write_packet(&mut writer, user_id, PacketData::HolePunch(HolePunch)).await.unwrap();
|
||||||
socket.send_to(&buf, addr.as_ref().unwrap()).await.expect("kys");
|
// socket.send_to(&buf, addr.as_ref().unwrap()).await.expect("kys");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,30 @@ impl Handler<Packet> for PlayerActor {
|
||||||
PacketData::UdpInit(UdpInit { port }) => {
|
PacketData::UdpInit(UdpInit { port }) => {
|
||||||
info!("got udp init {port}!");
|
info!("got udp init {port}!");
|
||||||
let _ = self.write_sender.send(WriteMessage::SetUdp(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;
|
return;
|
||||||
}
|
}
|
||||||
PacketData::Connect(..) | PacketData::Init(..) => {
|
PacketData::Connect(..) | PacketData::Init(..) => {
|
||||||
|
|
Loading…
Reference in a new issue