Improved a few things
This commit is contained in:
+1
-1
@@ -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
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user