Improved a few things

This commit is contained in:
2026-08-28 14:16:58 +02:00
parent 9d59da3a4e
commit ba17cec5e1
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ pub async fn crypto_handshake(
.transpose()? .transpose()?
.ok_or(anyhow::anyhow!("Failed to get client x key"))? .ok_or(anyhow::anyhow!("Failed to get client x key"))?
else { else {
return Err(anyhow::anyhow!("")); return Err(anyhow::anyhow!("WS message is not binary"));
}; };
let client_pubkey = X25519Public::from(*raw_pubkey.as_array().ok_or(anyhow::anyhow!( let client_pubkey = X25519Public::from(*raw_pubkey.as_array().ok_or(anyhow::anyhow!(
+6 -3
View File
@@ -74,9 +74,12 @@ impl Server {
let s = self.clone(); let s = self.clone();
ws.on_upgrade(move |socket: WebSocket| async move { ws.on_upgrade(move |socket: WebSocket| async move {
let Ok(client) = crate::crypto::crypto_handshake(&s, socket).await else { let client = match crate::crypto::crypto_handshake(&s, socket).await {
eprintln!("Filed to initialize crypto"); Ok(client) => client,
return; Err(err) => {
eprintln!("Failed to initialize crypto: {err}");
return;
}
}; };
match UserConnections::initialize(&s, &client).await { match UserConnections::initialize(&s, &client).await {