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

Commit 7d53c94

Browse files
tomakabkchr
authored andcommitted
Use AsyncReadExt::read_exact, not just read (#6977)
1 parent 6b2f7ea commit 7d53c94

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/network/src/protocol/generic_proto/upgrade/notifications.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ where TSubstream: AsyncRead + AsyncWrite + Unpin + Send + 'static,
148148

149149
let mut initial_message = vec![0u8; initial_message_len];
150150
if !initial_message.is_empty() {
151-
socket.read(&mut initial_message).await?;
151+
socket.read_exact(&mut initial_message).await?;
152152
}
153153

154154
let substream = NotificationsInSubstream {
@@ -300,7 +300,7 @@ where TSubstream: AsyncRead + AsyncWrite + Unpin + Send + 'static,
300300

301301
let mut handshake = vec![0u8; handshake_len];
302302
if !handshake.is_empty() {
303-
socket.read(&mut handshake).await?;
303+
socket.read_exact(&mut handshake).await?;
304304
}
305305

306306
Ok((handshake, NotificationsOutSubstream {

0 commit comments

Comments
 (0)