From 088164eaf98b245d8b2a4b5592c69b991467d4e0 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 28 Aug 2020 15:05:28 +0200 Subject: [PATCH] Use AsyncReadExt::read_exact, not just read --- .../src/protocol/generic_proto/upgrade/notifications.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/network/src/protocol/generic_proto/upgrade/notifications.rs b/client/network/src/protocol/generic_proto/upgrade/notifications.rs index 80fd7761f8088..f2f8d6365b8de 100644 --- a/client/network/src/protocol/generic_proto/upgrade/notifications.rs +++ b/client/network/src/protocol/generic_proto/upgrade/notifications.rs @@ -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 { @@ -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 {