Use AsyncReadExt::read_exact, not just read (#6977)

This commit is contained in:
Pierre Krieger authored and GitHub committed 2020-08-31 08:55:43 +00:00
1 parent d0a58a7360
commit e9d446a4ce
1 file changed
+2 -2
@@ -148,7 +148,7 @@ where TSubstream: AsyncRead + AsyncWrite + Unpin + Send + 'static,
let mut initial_message = vec![0u8; initial_message_len];
if !initial_message.is_empty() {
socket.read(&mut initial_message).await?;
socket.read_exact(&mut initial_message).await?;
}
let substream = NotificationsInSubstream {
@@ -300,7 +300,7 @@ where TSubstream: AsyncRead + AsyncWrite + Unpin + Send + 'static,
let mut handshake = vec![0u8; handshake_len];
if !handshake.is_empty() {
socket.read(&mut handshake).await?;
socket.read_exact(&mut handshake).await?;
}
Ok((handshake, NotificationsOutSubstream {