bring back logging
This commit is contained in:
parent
71e6ca35c7
commit
bd581ae317
|
@ -116,7 +116,7 @@ async fn udp_server(socket: Arc<UdpSocket>) {
|
||||||
loop {
|
loop {
|
||||||
let mut packet = [0u8; 256];
|
let mut packet = [0u8; 256];
|
||||||
let (size, _addr) = socket.recv_from(&mut packet).await.unwrap();
|
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 {
|
match read_packet(&mut Cursor::new(&mut packet[..size]), true).await {
|
||||||
Ok(packet) => {
|
Ok(packet) => {
|
||||||
// info!("packet from udp {packet:?}");
|
// info!("packet from udp {packet:?}");
|
||||||
|
|
|
@ -246,9 +246,9 @@ impl Handler<Packet> for PlayerActor {
|
||||||
type Return = ();
|
type Return = ();
|
||||||
|
|
||||||
async fn handle(&mut self, packet: Packet, _: &mut xtra::Context<Self>) {
|
async fn handle(&mut self, packet: Packet, _: &mut xtra::Context<Self>) {
|
||||||
if matches!(packet.data, PacketData::HolePunch(..)) {
|
// if matches!(packet.data, PacketData::HolePunch(..)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if packet.user_id == self.id {
|
if packet.user_id == self.id {
|
||||||
match packet.data {
|
match packet.data {
|
||||||
|
@ -256,9 +256,10 @@ impl Handler<Packet> for PlayerActor {
|
||||||
info!("got hole punch!");
|
info!("got hole punch!");
|
||||||
}
|
}
|
||||||
PacketData::UdpInit(UdpInit { port }) => {
|
PacketData::UdpInit(UdpInit { 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 {
|
let _ = self.write_sender.send(WriteMessage::Data(Packet {
|
||||||
user_id: 0,
|
user_id: self.id,
|
||||||
udp: true,
|
udp: true,
|
||||||
data: PacketData::HolePunch(HolePunch),
|
data: PacketData::HolePunch(HolePunch),
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue