From fbf8dfc6592f869a6aef64453e3248b438b9e93a Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Wed, 12 Aug 2026 09:08:01 -0400 Subject: [PATCH] Meta --- src/protocol/initialize.rs | 16 +++++++++++++++- src/protocol/mod.rs | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/protocol/initialize.rs b/src/protocol/initialize.rs index 97bfd4d..40b4d79 100644 --- a/src/protocol/initialize.rs +++ b/src/protocol/initialize.rs @@ -64,9 +64,23 @@ impl super::Client { .await?; } + let Some(ServerMethod::Meta(meta)) = Client::read_socket(&mut socket).await? else { + Client::send_socket( + &mut socket, + ClientMethod::Error { + error: Cow::Borrowed("Expected meta"), + }, + ) + .await?; + + return Err(anyhow::anyhow!( + "Expected meta, client called another method" + )); + }; + Ok(Self { socket, - meta: super::ClientMeta {}, + meta, public_key, }) } diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index efbb987..460530f 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -48,6 +48,8 @@ pub enum ServerMethod { hostname: String, }, + Meta(ClientMeta), + Error { error: String, }, @@ -64,6 +66,8 @@ impl Client { .await?; } + ServerMethod::Meta(meta) => {} + ServerMethod::Error { error } => { eprintln!("Client error: {error}"); }