Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
golangboy committed Feb 7, 2024
1 parent c1fce04 commit cdf6078
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ async fn perform_first_stage() -> Result<(), Box<dyn std::error::Error>> {
progress_bar_clone.lock().await.inc(1);
match next_ipv4_address {
Some(mut ipv4_address) => {
let connection_attempt = tokio::net::TcpStream::connect(ipv4_address.clone() + ":80");
let connection_result =
tokio::time::timeout(tokio::time::Duration::new(1, 0), connection_attempt).await;
let connection_attempt =
tokio::net::TcpStream::connect(ipv4_address.clone() + ":80");
let connection_result = tokio::time::timeout(
tokio::time::Duration::new(1, 0),
connection_attempt,
)
.await;
match connection_result {
Ok(result) => match result {
Ok(mut connection) => {
Expand Down Expand Up @@ -69,7 +73,8 @@ async fn perform_second_stage() -> Result<(), Box<dyn std::error::Error>> {
.collect();
let progress_bar = ProgressBar::new(live_ipv4_addresses.len() as u64);
let mut tasks = Vec::new();
let live_ipv4_addresses_iter_lock = Arc::new(tokio::sync::Mutex::new(live_ipv4_addresses.into_iter()));
let live_ipv4_addresses_iter_lock =
Arc::new(tokio::sync::Mutex::new(live_ipv4_addresses.into_iter()));
for _ in 1..10 {
let addresses_iter_clone = live_ipv4_addresses_iter_lock.clone();
let ping_result_file_clone = ping_result_file_lock.clone();
Expand Down

0 comments on commit cdf6078

Please sign in to comment.