Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Use AsyncReadExt::read_exact, not just read #6977

Merged
1 commit merged into from
Aug 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,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 {
Expand Down Expand Up @@ -292,7 +292,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 {
Expand Down