From df2df53f7d750aadc2332ed64585d1933af6ef9f Mon Sep 17 00:00:00 2001 From: Ara Sadoyan Date: Wed, 12 Mar 2025 13:11:49 +0100 Subject: [PATCH] Compare dashmaps --- src/utils/compare.rs | 4 ++-- src/utils/discovery.rs | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/utils/compare.rs b/src/utils/compare.rs index 6b94704..ae33805 100644 --- a/src/utils/compare.rs +++ b/src/utils/compare.rs @@ -2,7 +2,7 @@ use crate::utils::tools::*; use std::collections::HashSet; use tokio::sync::RwLockReadGuard; -#[allow(dead_code)] +// #[allow(dead_code)] pub fn dm(map1: &RwLockReadGuard, map2: &UpstreamMap) -> bool { if map1.len() != map2.len() { return false; // Different number of keys @@ -22,7 +22,7 @@ pub fn dm(map1: &RwLockReadGuard, map2: &UpstreamMap) -> bool { } true } -// #[allow(dead_code)] +#[allow(dead_code)] pub fn dam(map1: &UpstresmDashMap, map2: &UpstresmDashMap) -> bool { // Step 1: Check if both maps have the same keys let keys1: HashSet<_> = map1.iter().map(|entry| entry.key().clone()).collect(); diff --git a/src/utils/discovery.rs b/src/utils/discovery.rs index b4200de..2a666ea 100644 --- a/src/utils/discovery.rs +++ b/src/utils/discovery.rs @@ -153,7 +153,6 @@ pub fn build_upstreams(d: &str, kind: &str) -> UpstreamMap { pub fn build_upstreams2(d: &str, kind: &str) -> UpstresmDashMap { let upstreams: UpstresmDashMap = DashMap::new(); - let hopar: UpstresmDashMap = DashMap::new(); let mut contents = d.to_string(); match kind { "filepath" => { @@ -210,12 +209,6 @@ pub fn build_upstreams2(d: &str, kind: &str) -> UpstresmDashMap { .or_insert_with(|| (Vec::new(), AtomicUsize::new(0))) .0 .push((ip.to_string(), port, ssl, proto.to_string())); - let entry = hopar.entry(hostname.to_string()).or_insert_with(DashMap::new); - entry - .entry(path.to_string()) - .or_insert_with(|| (Vec::new(), AtomicUsize::new(0))) - .0 - .push((ip.to_string(), port, ssl, proto.to_string())); } // println!("\n\nResult ===> {} <===\n\n", dam(&hopar, &upstreams)); // println!("{:?}", hopar);