From a35633337848216b9ad63ca730a53b9b971bcca1 Mon Sep 17 00:00:00 2001 From: skifli <121291719+skifli@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:21:11 +0000 Subject: [PATCH] fix: client & server bugs --- bruty_client/Cargo.toml | 2 +- bruty_client/src/client_threads.rs | 10 +++++++++- bruty_server/Cargo.toml | 2 +- bruty_server/src/server_threads.rs | 5 ++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bruty_client/Cargo.toml b/bruty_client/Cargo.toml index fce3e05..b94ee20 100644 --- a/bruty_client/Cargo.toml +++ b/bruty_client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bruty_client" authors = ["skifli"] -version = "0.2.6" +version = "0.2.7" edition = "2021" [dependencies] diff --git a/bruty_client/src/client_threads.rs b/bruty_client/src/client_threads.rs index 667b8f2..769b46e 100644 --- a/bruty_client/src/client_threads.rs +++ b/bruty_client/src/client_threads.rs @@ -8,7 +8,15 @@ pub async fn id_checker( let url_base = "https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=".to_string(); loop { - let id = id_receiver.recv_async().await.unwrap(); // Await an ID to check + let id = id_receiver.recv_async().await; + + if id.is_err() { + tokio::time::sleep(tokio::time::Duration::from_secs(1)).await; + + continue; + } + + let id = id.unwrap(); let id_vec = id.clone(); let id_str = id.iter().collect::(); diff --git a/bruty_server/Cargo.toml b/bruty_server/Cargo.toml index 5b22e43..9c2a9b4 100644 --- a/bruty_server/Cargo.toml +++ b/bruty_server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bruty_server" authors = ["skifli"] -version = "0.2.6" +version = "0.2.7" edition = "2021" [dependencies] diff --git a/bruty_server/src/server_threads.rs b/bruty_server/src/server_threads.rs index fc147a9..c70d0df 100644 --- a/bruty_server/src/server_threads.rs +++ b/bruty_server/src/server_threads.rs @@ -106,7 +106,7 @@ pub async fn results_progress_handler( } if awaiting_current_id_update.len() > 0 { - for (index, id) in awaiting_current_id_update.clone().iter().enumerate() { + for id in awaiting_current_id_update.clone() { // Only want to update current ID when all awaiting IDs start with current ID. // This means that we are not waiting for any results from the previous current ID. @@ -150,12 +150,11 @@ pub async fn results_progress_handler( } else { if cant_update_awaiting_results != awaiting_current_id_update { log::warn!( - "Can't update current ID to {:?}[{}], awaiting {:?}", + "Can't update current ID to {:?}, awaiting {:?}", awaiting_current_id_update .iter() .map(|x| x.iter().collect::()) .collect::>(), - index, awaiting_results .iter() .map(|x| x.iter().collect::())