Compare commits
No commits in common. "3be12f7807218ecb322bea5cb0c7cea789d87ba3" and "f67146aa13677045b08f13baeb235f5a9f307a99" have entirely different histories.
3be12f7807
...
f67146aa13
@ -93,10 +93,7 @@ impl NodeServer {
|
|||||||
|
|
||||||
let conn = if let Err(e) = conn {
|
let conn = if let Err(e) = conn {
|
||||||
println!("Error accepting TLS connection: {e}");
|
println!("Error accepting TLS connection: {e}");
|
||||||
let attack_error_messages = ["handshake", "certificate", "quote"];
|
if e.to_string().contains("HandshakeFailure") {
|
||||||
|
|
||||||
let err_str = e.to_string().to_lowercase();
|
|
||||||
if attack_error_messages.iter().any(|att_er_str| err_str.contains(att_er_str)) {
|
|
||||||
state.increase_net_attacks().await;
|
state.increase_net_attacks().await;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -200,7 +197,6 @@ impl Update for NodeServer {
|
|||||||
yield Ok(update.update);
|
yield Ok(update.update);
|
||||||
}
|
}
|
||||||
// TODO: check if disconnect client if too many connections are active
|
// TODO: check if disconnect client if too many connections are active
|
||||||
// Its tested and working
|
|
||||||
if tx.receiver_count() > 9 {
|
if tx.receiver_count() > 9 {
|
||||||
error_status = Status::internal("Already have too many clients. Connect to another server.");
|
error_status = Status::internal("Already have too many clients. Connect to another server.");
|
||||||
break;
|
break;
|
||||||
|
@ -55,9 +55,7 @@ pub async fn heartbeat(
|
|||||||
state.remove_inactive_nodes().await;
|
state.remove_inactive_nodes().await;
|
||||||
let connected_ips = state.get_connected_ips().await;
|
let connected_ips = state.get_connected_ips().await;
|
||||||
println!("Connected nodes ({}): {:?}", connected_ips.len(), connected_ips);
|
println!("Connected nodes ({}): {:?}", connected_ips.len(), connected_ips);
|
||||||
let my_node_info = state.get_my_info().await;
|
let _ = tx.send((state.get_my_ip().await, state.get_my_info().await).into());
|
||||||
my_node_info.save();
|
|
||||||
let _ = tx.send((state.get_my_ip().await, my_node_info).into());
|
|
||||||
if connected_ips.len() < NUM_CONNECTIONS {
|
if connected_ips.len() < NUM_CONNECTIONS {
|
||||||
if let Some(node_ip) = state.get_random_disconnected_ip().await {
|
if let Some(node_ip) = state.get_random_disconnected_ip().await {
|
||||||
println!("Dialing random node {}", node_ip);
|
println!("Dialing random node {}", node_ip);
|
||||||
|
Loading…
Reference in New Issue
Block a user