From 186c3612aa5f98decad8d67fef39e93b0ee96e56 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 13 Sep 2019 19:18:42 -0700 Subject: [PATCH] print out packets --- src/common/client.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/client.rs b/src/common/client.rs index 73062a2..12f2c8c 100644 --- a/src/common/client.rs +++ b/src/common/client.rs @@ -101,9 +101,11 @@ impl Client where let pkt_data = self.incoming_data.drain(..pkt_len).collect::>(); + println!("[recv: buf] {:?}", pkt_data); let pkt = R::from_bytes(&pkt_data[..pkt_size]) .map_err(|err| -> PacketNetworkError { err.into() })?; + println!("[recv] {:?}", pkt); result.push(pkt); } Ok(result) @@ -112,7 +114,12 @@ impl Client where pub fn send_pkt(&mut self, pkt: S) { println!("[send] {:?}", pkt); let buf = pkt.as_bytes(); - println!("[send: buf] {:?}", buf); + if buf.len() < 1024*2 { + println!("[send: buf] {:?}", buf); + } + else { + println!("[send: buf] [...large buffer...]"); + } let mut cbuf = self.cipher_out.encrypt(&buf).unwrap(); self.send_buffer.append(&mut cbuf); self.send_data();