forked from trinitrix/core
fix(cbs): added missing parts of the handshake
This commit is contained in:
parent
f6a1b5200a
commit
fc8efe5060
|
@ -56,14 +56,21 @@ impl UnstableConnection {
|
||||||
let packet = Packet::recv(&mut sock_rx, &cipher, &nonce).await?;
|
let packet = Packet::recv(&mut sock_rx, &cipher, &nonce).await?;
|
||||||
match packet {
|
match packet {
|
||||||
Packet::Request { id, body } => {
|
Packet::Request { id, body } => {
|
||||||
Packet::response(id_pool.acquire(), id, Response::Success)
|
match body {
|
||||||
.send(&mut sock_tx, &cipher, &nonce)
|
Request::HandshakeUpgradeConnection => {
|
||||||
.await?;
|
Packet::response(id_pool.acquire(), id, Response::Success)
|
||||||
|
.send(&mut sock_tx, &cipher, &nonce)
|
||||||
|
.await?;
|
||||||
|
|
||||||
cli_log::info!(
|
cli_log::info!(
|
||||||
"CBS {id}: upgraded connection to encrypted messagepack",
|
"CBS {id}: upgraded connection to encrypted messagepack",
|
||||||
id = self.id
|
id = self.id
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
req => return Err(anyhow!(
|
||||||
|
"expected cbs to send: Request::HandshakeUpgradeConnection, but got: Request::{req}"
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
body => {
|
body => {
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
|
@ -72,6 +79,10 @@ impl UnstableConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Packet::request(id_pool.acquire(), Request::HandshakeSuccess)
|
||||||
|
.send(&mut sock_tx, &cipher, &nonce)
|
||||||
|
.await?;
|
||||||
|
|
||||||
// Poll packets from socket
|
// Poll packets from socket
|
||||||
{
|
{
|
||||||
let cipher = cipher.clone();
|
let cipher = cipher.clone();
|
||||||
|
|
Loading…
Reference in New Issue