mirror of
https://github.com/house-of-vanity/rexec.git
synced 2025-07-08 09:14:08 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
de31eeef7a |
18
src/main.rs
18
src/main.rs
@ -210,8 +210,9 @@ fn main() {
|
|||||||
// Do DNS resolution in parallel but store results for ordered display later
|
// Do DNS resolution in parallel but store results for ordered display later
|
||||||
let resolved_ips_with_indices = Arc::new(Mutex::new(Vec::<(String, IpAddr, usize)>::new()));
|
let resolved_ips_with_indices = Arc::new(Mutex::new(Vec::<(String, IpAddr, usize)>::new()));
|
||||||
|
|
||||||
host_with_indices.par_iter().for_each(|(host, idx)| {
|
host_with_indices
|
||||||
match lookup_host(&host.name) {
|
.par_iter()
|
||||||
|
.for_each(|(host, idx)| match lookup_host(&host.name) {
|
||||||
Ok(ips) if !ips.is_empty() => {
|
Ok(ips) if !ips.is_empty() => {
|
||||||
let ip = ips[0];
|
let ip = ips[0];
|
||||||
let mut results = resolved_ips_with_indices.lock().unwrap();
|
let mut results = resolved_ips_with_indices.lock().unwrap();
|
||||||
@ -219,12 +220,19 @@ fn main() {
|
|||||||
}
|
}
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let mut results = resolved_ips_with_indices.lock().unwrap();
|
let mut results = resolved_ips_with_indices.lock().unwrap();
|
||||||
results.push((host.name.clone(), IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)), *idx));
|
results.push((
|
||||||
|
host.name.clone(),
|
||||||
|
IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)),
|
||||||
|
*idx,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let mut results = resolved_ips_with_indices.lock().unwrap();
|
let mut results = resolved_ips_with_indices.lock().unwrap();
|
||||||
results.push((host.name.clone(), IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)), *idx));
|
results.push((
|
||||||
}
|
host.name.clone(),
|
||||||
|
IpAddr::V4(std::net::Ipv4Addr::new(0, 0, 0, 0)),
|
||||||
|
*idx,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user