about summary refs log tree commit diff
path: root/users/picnoir/tvix-daemon
diff options
context:
space:
mode:
authorVova Kryachko <v.kryachko@gmail.com>2024-11-02T17·15+0000
committerVladimir Kryachko <v.kryachko@gmail.com>2024-11-02T18·08+0000
commitaecf0641a4917994e58e0fe7a9cfecb596f0c4f6 (patch)
tree7ab43587958b818bb8bc1276831818bc6d112579 /users/picnoir/tvix-daemon
parent4ec9a4b7dfb7a22fca39715e20f4973d299fd7fa (diff)
fix(tvix/nix_compat): Fix nix-daemon handshake r/8880
Existing handshake behavior assumed that the server version is always
at least as new as the client. Meaning that the client's version was
always picked the handshake details as well as for further communication

This change removes that assumption and correctly uses
min(server_version, client_version).

Change-Id: Ia5dad4613dd5f69a0aeb6c9d86982f1f36fe1a4c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12722
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'users/picnoir/tvix-daemon')
-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 dc49b209e009..580f07652097 100644
--- a/users/picnoir/tvix-daemon/src/main.rs
+++ b/users/picnoir/tvix-daemon/src/main.rs
@@ -67,14 +67,14 @@ where
     R: AsyncReadExt + AsyncWriteExt + Unpin + std::fmt::Debug,
 {
     match server_handshake_client(&mut conn, "2.18.2", Trust::Trusted).await {
-        Ok(client_protocol_version) => {
+        Ok(picked_protocol_version) => {
             let mut client_connection = ClientConnection {
                 conn,
-                version: client_protocol_version,
+                version: picked_protocol_version,
                 client_settings: None,
             };
             debug!("Client hanshake succeeded");
-            debug!(client_protocol_version = ?client_protocol_version);
+            debug!(picked_protocol_version = ?picked_protocol_version);
             // TODO: implement logging. For now, we'll just send
             // STDERR_LAST, which is good enough to get Nix respond to
             // us.