precise network attacks metric

This commit is contained in:
Valentyn Faychuk 2024-12-07 22:55:50 +02:00
parent 334b600a2d
commit 4d93229f19
Signed by: valy
GPG Key ID: F1AB995E20FEADC5
2 changed files with 10 additions and 5 deletions

@ -89,7 +89,9 @@ impl ConnManager {
let rx_stream = BroadcastStream::new(rx).filter_map(|n| n.ok());
let response = client.get_updates(rx_stream).await.map_err(|e| {
println!("Error connecting to {node_ip}: {e}");
if e.to_string().contains("QuoteVerifyError") {
self.state.increase_net_attacks();
}
e
})?;
let mut resp_stream = response.into_inner();
@ -159,7 +161,9 @@ pub async fn key_grabber(
let response = client.get_keys(tonic::Request::new(Empty {})).await.map_err(|e| {
println!("Error getting keys from {node_ip}: {e}");
if e.to_string().contains("QuoteVerifyError") {
state.increase_net_attacks();
}
e
})?;
Ok(response.into_inner())

@ -55,7 +55,6 @@ impl MyServer {
Ok(incoming) => incoming,
Err(e) => {
println!("Error accepting connection: {}", e);
state.increase_net_attacks();
continue;
}
};
@ -79,8 +78,10 @@ impl MyServer {
.await;
let conn = if let Err(e) = conn {
println!("Error accepting TLS connection: {}", e);
println!("Error accepting TLS connection: {e}");
if e.to_string().contains("HandshakeFailure") {
state.increase_net_attacks();
}
return;
} else {
conn.unwrap()