diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-18T09·36+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-04-18T12·22+0000 |
commit | cf86a098cf93edb29e0b53e4d6e56ed05e7ee2ed (patch) | |
tree | ff582670834119e48b14b57bcfa13b3f56825371 /users | |
parent | 2c884b8bd2918974c1ad281aea28edb83d2d5661 (diff) |
feat(tvix/nix-compat/nix_daemon/version): add ProtocolVersion r/7955
This provides a nice wrapper struct to deal with versions. Change-Id: I6acc03bc9f8d84a0583196073b52776c45d3fe92 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11454 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
Diffstat (limited to 'users')
-rw-r--r-- | users/picnoir/tvix-daemon/src/main.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/users/picnoir/tvix-daemon/src/main.rs b/users/picnoir/tvix-daemon/src/main.rs index 27bec90ce47f..102067fcf7d4 100644 --- a/users/picnoir/tvix-daemon/src/main.rs +++ b/users/picnoir/tvix-daemon/src/main.rs @@ -3,8 +3,8 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio_listener::{self, SystemOptions, UserOptions}; use tracing::{debug, error, info, instrument, Level}; -use nix_compat::wire; use nix_compat::worker_protocol::{self, server_handshake_client, ClientSettings, Trust}; +use nix_compat::{wire, ProtocolVersion}; #[derive(Parser, Debug)] struct Cli { @@ -55,7 +55,7 @@ async fn main() { #[derive(Debug)] struct ClientConnection<R: AsyncReadExt + AsyncWriteExt + Unpin> { pub conn: R, - pub version_minor: u64, + pub version: ProtocolVersion, pub client_settings: Option<ClientSettings>, } @@ -70,7 +70,7 @@ where Ok(client_protocol_version) => { let mut client_connection = ClientConnection { conn, - version_minor: client_protocol_version, + version: client_protocol_version, client_settings: None, }; debug!("Client hanshake succeeded"); @@ -106,8 +106,7 @@ async fn op_set_options<R>(conn: &mut ClientConnection<R>) -> std::io::Result<Cl where R: AsyncReadExt + AsyncWriteExt + Unpin + std::fmt::Debug, { - let settings = - worker_protocol::read_client_settings(&mut conn.conn, conn.version_minor).await?; + let settings = worker_protocol::read_client_settings(&mut conn.conn, conn.version).await?; // The client expects us to send some logs when we're processing // the settings. Sending STDERR_LAST signal we're done processing. wire::write_u64(&mut conn.conn, worker_protocol::STDERR_LAST).await?; |