This commit is contained in:
Tiago Batista Cardoso
2026-01-24 22:32:01 +01:00
parent a3648c2116
commit 7a1155c0bd
5 changed files with 2 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -314,7 +314,7 @@ pub fn parse_message(
ERROR => { ERROR => {
if let Ok(err_received) = if let Ok(err_received) =
String::from_utf8(received_message[LENGTH..(msg_length + LENGTH)].to_vec()) String::from_utf8(received_message[LENGTH..(msg_length + LENGTH + 4)].to_vec())
{ {
let err_msg = format!("Error received from peer {} : {}", ip, err_received); let err_msg = format!("Error received from peer {} : {}", ip, err_received);
let _ = cmd_tx_clone.send(NetworkEvent::Error(err_msg)); let _ = cmd_tx_clone.send(NetworkEvent::Error(err_msg));

View File

@@ -66,7 +66,6 @@ pub async fn perform_handshake(
match server_addr_query.await { match server_addr_query.await {
Some(sockaddr_bytes) => { Some(sockaddr_bytes) => {
sd.set_servername(username); sd.set_servername(username);
sd.set_serveraddress(sockaddr_bytes.to_string());
// first: &SocketAddr // first: &SocketAddr
let mut payload = Vec::new(); let mut payload = Vec::new();
payload.extend_from_slice(&0u32.to_be_bytes()); payload.extend_from_slice(&0u32.to_be_bytes());
@@ -74,6 +73,7 @@ pub async fn perform_handshake(
let hello_handshake = construct_message(1, payload, id, crypto_pair); let hello_handshake = construct_message(1, payload, id, crypto_pair);
if is_server_handshake { if is_server_handshake {
sd.add_message(id, EventType::Hello); sd.add_message(id, EventType::Hello);
sd.set_serveraddress(sockaddr_bytes.to_string());
} else { } else {
sd.add_message(id, EventType::HelloThenRootRequest); sd.add_message(id, EventType::HelloThenRootRequest);
} }