print out packets
This commit is contained in:
parent
4bd205753e
commit
186c3612aa
@ -101,9 +101,11 @@ impl<S, R> Client<S, R> where
|
||||
|
||||
let pkt_data = self.incoming_data.drain(..pkt_len).collect::<Vec<_>>();
|
||||
|
||||
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<S, R> Client<S, R> 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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user