Remove debugging logs
This commit is contained in:
parent
c10f6cfb82
commit
591cfee715
2 changed files with 5 additions and 5 deletions
|
@ -18,10 +18,13 @@ pub fn handle_network_input(
|
||||||
) -> Result {
|
) -> Result {
|
||||||
for (mut message, address) in from_socket.iter() {
|
for (mut message, address) in from_socket.iter() {
|
||||||
if message.len() < 16 {
|
if message.len() < 16 {
|
||||||
return Err(format!("Message of length {} cannot contain UUID", message.len()).into());
|
return Err(format!(
|
||||||
|
"Message of length {} is not large enough to contain UUID",
|
||||||
|
message.len()
|
||||||
|
)
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
let uuid = Uuid::from_slice(message.split_off(message.len() - 16).as_slice())?;
|
let uuid = Uuid::from_slice(message.split_off(message.len() - 16).as_slice())?;
|
||||||
info!("Receiving: {:?} from {}", message, uuid);
|
|
||||||
to_app.write(InboundPacket(Packet::new(message, uuid)));
|
to_app.write(InboundPacket(Packet::new(message, uuid)));
|
||||||
if let Some(peer_id) = peer_map.get(&uuid) {
|
if let Some(peer_id) = peer_map.get(&uuid) {
|
||||||
let (peer, mut last) = peers.get_mut(*peer_id)?;
|
let (peer, mut last) = peers.get_mut(*peer_id)?;
|
||||||
|
@ -46,7 +49,6 @@ pub fn handle_network_output(
|
||||||
for packet in from_app.read() {
|
for packet in from_app.read() {
|
||||||
let peer_id = peer_map.try_get(&packet.0.peer)?;
|
let peer_id = peer_map.try_get(&packet.0.peer)?;
|
||||||
let (peer, mut last) = peers.get_mut(*peer_id)?;
|
let (peer, mut last) = peers.get_mut(*peer_id)?;
|
||||||
warn!("Sending: {:?} to {}", packet.0.message, peer.uuid);
|
|
||||||
// Append our UUID for client identification
|
// Append our UUID for client identification
|
||||||
let message = [packet.0.message.as_slice(), config.id.as_bytes()].concat();
|
let message = [packet.0.message.as_slice(), config.id.as_bytes()].concat();
|
||||||
to_socket.send(message, peer.addr)?;
|
to_socket.send(message, peer.addr)?;
|
||||||
|
|
|
@ -108,7 +108,6 @@ pub fn handle_peer_change(
|
||||||
warn!("Peer {} doesn't exist (just added?)", change.peer);
|
warn!("Peer {} doesn't exist (just added?)", change.peer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info!("Removing peer {}", change.peer);
|
|
||||||
commands.get_entity(*entity)?.despawn();
|
commands.get_entity(*entity)?.despawn();
|
||||||
peer_map.remove(&change.peer);
|
peer_map.remove(&change.peer);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,6 @@ pub fn handle_peer_change(
|
||||||
}
|
}
|
||||||
if peer_map.len() > 1 {
|
if peer_map.len() > 1 {
|
||||||
if let Some(entity) = peer_map.remove(&Uuid::nil()) {
|
if let Some(entity) = peer_map.remove(&Uuid::nil()) {
|
||||||
warn!("Removing initial Peer");
|
|
||||||
commands.get_entity(entity)?.despawn();
|
commands.get_entity(entity)?.despawn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue