chore(users/picnoir/tvix-daemon): apply clippy suggestions

Remove potential partial reads/writes and instead read/write the full
buffer size: we want those to be 64 bits.

Change-Id: I1f767baf23fa80c2babb8113f61d1a9e72a8d8dd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11350
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Picnoir 2024-04-03 11:31:19 +02:00 committed by picnoir picnoir
parent c59e11dc3e
commit 3821fd4224

View file

@ -86,7 +86,7 @@ where
&'a mut R: AsyncReadExt + AsyncWriteExt + Unpin + std::fmt::Debug,
{
let mut magic_hello = vec![0; 8];
conn.read(&mut magic_hello).await?;
conn.read_exact(&mut magic_hello).await?;
debug!("Hello read");
if magic_hello != primitive::MAGIC_HELLO {
Err(anyhow!(
@ -95,8 +95,8 @@ where
primitive::MAGIC_HELLO
))
} else {
conn.write(&primitive::MAGIC_HELLO_RESPONSE).await?;
conn.write(&primitive::PROTOCOL_VERSION).await?;
conn.write_all(&primitive::MAGIC_HELLO_RESPONSE).await?;
conn.write_all(&primitive::PROTOCOL_VERSION).await?;
conn.flush().await?;
debug!("Hello responded");
let client_version = primitive::read_u64(&mut conn).await?;