Skip to content

Commit 6a3e8c7

Browse files
committed
Add sent bytes logging
1 parent 99f1e34 commit 6a3e8c7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/protocol/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,10 +1006,22 @@ impl Conn {
10061006
}
10071007

10081008
pub fn write_packet<T: PacketType>(&mut self, packet: T) -> Result<(), Error> {
1009+
let network_debug = unsafe { NETWORK_DEBUG };
1010+
1011+
/* TODO: debug printing packets to send
1012+
if network_debug {
1013+
println!("about to send {:?}", packet);
1014+
}
1015+
*/
1016+
10091017
let mut buf = Vec::new();
10101018
VarInt(packet.packet_id(self.protocol_version)).write_to(&mut buf)?;
10111019
packet.write(&mut buf)?;
10121020

1021+
if network_debug {
1022+
println!("sent bytes {:?}", buf);
1023+
}
1024+
10131025
let mut extra = if self.compression_threshold >= 0 {
10141026
1
10151027
} else {

0 commit comments

Comments
 (0)