remove and add logging
This commit is contained in:
parent
bd581ae317
commit
4f75b3c156
|
@ -116,7 +116,7 @@ async fn udp_server(socket: Arc<UdpSocket>) {
|
|||
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:?}");
|
||||
|
|
|
@ -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<Packet> 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(..) => {
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue