diff options
-rw-r--r-- | controller/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/controller/src/lib.rs b/controller/src/lib.rs index ee02b3b..b53502f 100644 --- a/controller/src/lib.rs +++ b/controller/src/lib.rs @@ -35,7 +35,7 @@ async fn send_vectored( async fn receive_message(reader: &mut (impl AsyncReadExt + Unpin)) -> io::Result<Option<RawMessage>> { let mut header = [0u8; 17]; - if let Err(e) = reader.read(&mut header).await { + if let Err(e) = reader.read_exact(&mut header).await { if e.kind() == ErrorKind::UnexpectedEof { return Ok(None); } else { return Err(e); } } @@ -46,7 +46,7 @@ async fn receive_message(reader: &mut (impl AsyncReadExt + Unpin)) let mut payload = Vec::new(); payload.resize(length, 0u8); - if let Err(e) = reader.read(&mut payload).await { + if let Err(e) = reader.read_exact(&mut payload).await { if e.kind() == ErrorKind::UnexpectedEof { return Ok(None); } else { return Err(e); } } |