about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPicnoir <picnoir@alternativebit.fr>2024-04-03T09·31+0200
committerpicnoir picnoir <picnoir@alternativebit.fr>2024-04-03T13·39+0000
commit3821fd4224c066c40fc492c8b049bd47c9a212fa (patch)
treebb7b44811944e85eddde18ef5c222fdffa85f994
parentc59e11dc3e6b57dd11feabd3478e95bd384eebcb (diff)
chore(users/picnoir/tvix-daemon): apply clippy suggestions r/7849
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
-rw-r--r--users/picnoir/tvix-daemon/src/main.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/users/picnoir/tvix-daemon/src/main.rs b/users/picnoir/tvix-daemon/src/main.rs
index 7b1b735baa8c..807b4791fe38 100644
--- a/users/picnoir/tvix-daemon/src/main.rs
+++ b/users/picnoir/tvix-daemon/src/main.rs
@@ -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?;