Improved a few things
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ pub async fn crypto_handshake(
|
||||
.transpose()?
|
||||
.ok_or(anyhow::anyhow!("Failed to get client x key"))?
|
||||
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!(
|
||||
|
||||
+5
-2
@@ -74,9 +74,12 @@ impl Server {
|
||||
let s = self.clone();
|
||||
|
||||
ws.on_upgrade(move |socket: WebSocket| async move {
|
||||
let Ok(client) = crate::crypto::crypto_handshake(&s, socket).await else {
|
||||
eprintln!("Filed to initialize crypto");
|
||||
let client = match crate::crypto::crypto_handshake(&s, socket).await {
|
||||
Ok(client) => client,
|
||||
Err(err) => {
|
||||
eprintln!("Failed to initialize crypto: {err}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
match UserConnections::initialize(&s, &client).await {
|
||||
|
||||
Reference in New Issue
Block a user