diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/protocol.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/protocol.rs b/src/protocol.rs index 577c732..955346e 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -112,8 +112,7 @@ impl UdpTraffic { } pub async fn read<T: AsyncRead + Unpin>(reader: &mut T, hdr_len: u8) -> Result<UdpTraffic> { - let mut buf = Vec::new(); - buf.resize(hdr_len as usize, 0); + let mut buf = vec![0; hdr_len as usize]; reader .read_exact(&mut buf) .await |