hardening the code

This commit is contained in:
aglkm
2026-03-15 18:35:06 +03:00
parent 5e2f8a40af
commit 59a08d36e9
+7 -5
View File
@@ -159,11 +159,13 @@ pub async fn get_connected_peers(dashboard: Arc<Mutex<Dashboard>>, statistics: A
match call_external("get_connected_peers", "[]", "1", "owner", endpoint).await { match call_external("get_connected_peers", "[]", "1", "owner", endpoint).await {
Ok(resp) => { Ok(resp) => {
if resp != Value::Null { if resp != Value::Null {
for peer in resp["result"]["Ok"].as_array().unwrap() { if resp1["result"]["Ok"].is_null() == false {
// Collecting user_agent nodes stats for peer in resp["result"]["Ok"].as_array().unwrap() {
if !addrs.contains(&peer["addr"].to_string()) { // Collecting user_agent nodes stats
*peers.entry(peer["user_agent"].to_string()).or_insert(0) += 1; if !addrs.contains(&peer["addr"].to_string()) {
addrs.push(peer["addr"].to_string()); *peers.entry(peer["user_agent"].to_string()).or_insert(0) += 1;
addrs.push(peer["addr"].to_string());
}
} }
} }
} }